Page 1 of 1

pass a date to Parse

Posted: Mon Aug 27, 2012 3:43 pm
by voip air

Trying to get this js working, testing with just the js as an event on a button click. Have the date picker on screen and the following js as an action on a button onclick. No errors returned when testing on line just does nothing. If I reference an invalid control instead of mobiledatepicker1 i do get a pop up with an error of undifined, but when i put the control name in the js nothing happens.
Goal is to pass a user entered date to parse.

Here is the js
var d = new Date();
d = Tiggr('mobiledatepicker1');
alert (d.val());


pass a date to Parse

Posted: Mon Aug 27, 2012 6:24 pm
by maxkatz

Tiggzi(id) returns a jQuery Mobile element, not the actual input. You can use this to get the input value:

code
$('div[dsid="mobiledatepicker1"] input').val();
/code


pass a date to Parse

Posted: Tue Aug 28, 2012 5:39 pm
by voip air

Thanks Max,

Still having some difficulty, might be my limited js experience. Thanks in advance.

I can get a pop up to pop up with this code
alert ($('div[dsid="mobiledatepicker1"] input').val());

But when I try to assign it to a variable - nothing no pop ups no errors (testing in browser)
var d = new Date();
d= $('div[dsid="mobiledatepicker1"] input').val();
alert (d.val());


pass a date to Parse

Posted: Tue Aug 28, 2012 5:41 pm
by maxkatz

Make sure the component is called 'mobiledatepicker1' or use whatever name you set.

You already got the value (with val()), so it will be:
alert (d);


pass a date to Parse

Posted: Tue Aug 28, 2012 5:43 pm
by voip air

Getting rid of the .val worked.
Last line is now, and works as expected
alert (d);