Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

Has new JQUERY mobile version broken earlier datepicker sollution?

Hi!

I notice that the Datepicker field is now working a little different (and better) on my Android phone with the recent update on a new JQUERY Mobile version. This is very good, but my service now is broken because I cannot read the Date value from the field anymore.

Max solved this 14 days ago with this line of javascript code:
$('input[type="date"]').val();

But now this only gives me the value "undefined" and not the selected date and my service on the page is not even called (just exits silently).

How can I read the date value from the datepicker control?

best regards

Ole H. Oftedal
Timeflex Systemer AS
http://www.timeflex.com
http://www.timeflex.no

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Has new JQUERY mobile version broken earlier datepicker sollution?

code
$('input[type="text"]').val();
/code

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

Has new JQUERY mobile version broken earlier datepicker sollution?

Nope. If i put this into an Alert box i shows up empty. Are you sure about type="text"?

I've tried it in a Safari browser and in the Tiggzi Tester. Same result both places.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Has new JQUERY mobile version broken earlier datepicker sollution?

Yes, we changed to type="text" instead of type="date" so there is no conflict with Chrome browser native data picker. It's recommended by jQuery Mobile.

If you have other input components, the query might not work. You should look at the generated source and adjust the query.

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

Has new JQUERY mobile version broken earlier datepicker sollution?

Adjust the query?

Yes I have several input type of type text. They are normal text input. I don't think I can change this in Tiggzi. Are you saying that I can't have a datepicker and other input components on the same form?

If I look at the code I also have: "id", "dsid" , "name" and "tiggzytype" for the DatepickerComponent. Can't I use any of these to select the value? I'm again twisting my head of. (The issue here might also be important for many other Tiggzy developers.)

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Has new JQUERY mobile version broken earlier datepicker sollution?

Of course you can, you can select anything in the DOM. The query that I showed you above is a very basic one and if you have more than one input field, it might not select the right now. You just need to adjust the query, make it more specific and select the input field for date picker. It's just jQuery, it's not Tiggzi builder.

If you share the app link, I'll show you what to use.

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

Has new JQUERY mobile version broken earlier datepicker sollution?

cool!

App name: Timeflex WebApp

You see a big button on the top of the Timeflex WebApp main screen. Its called "Alert datoinput value" or something like that.

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

Has new JQUERY mobile version broken earlier datepicker sollution?

Got it :-)

This is input field number 2 (starting from zero).

Every Tiggzi programmer must listen to Max and learn JQuery first, I think.

I've tried now a little bit:

You can select all input controls on the page with the 'input' selector. Then you can select the desired control based on the position/order on the page. This is done with the 'eq' filter.

My datepicker control is number two (two other normal input controls comes first):

javascript:
var test = $('input:eq(2)').val();
alert (test);

produces a nice date on the screen
:-)

But I still don't understand why I can't use the Tiggr function to select this type of control.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Has new JQUERY mobile version broken earlier datepicker sollution?

You can use Tiggzi(id) but you won't give you the input directly. It will give the date picker component (it has input, button, etc) so you would need to search further from it to get to the input field.

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

Has new JQUERY mobile version broken earlier datepicker sollution?

Solution:
Name the input field like this (if your datepicker component is named "Startdate)
$("[name='startDate']").find('input').attr('id','inputStartDate');

This now works if you would like to get the date:

var d = $("#inputStartDate").val();

see also https://getsatisfaction.com/apperyio/...

Return to “Issues”