Date picker for UI Page

kyrresc
Tera Expert

Hello,

I am working on implementing a date picker for a UI page. I have the following snippet in my HTML code-field:

<g:ui_date class = "form-control" id = "wt_start" name="work_time_start" value="${sysparm_start_date}"/>

Which displays like this:

find_real_file.png

which is fine. I am having issues retrieving this date in my client script. I have the following line:

var strDoc = gel("wt_start").value;

but it doesn't work... could anyone help?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@kyrresc 

you need to include the name attribute as well in the tag without which it won't work

so update as below

<g:ui_date class = "form-control" name="wt_start" id = "wt_start" name="work_time_start" value="${sysparm_start_date}"/>

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Kieran Anson
Kilo Patron

Hi,

You can just use JQuery to get the value: $("wt_start").value

Just like that? It doesn't seem to work.

Can you provide images / script from all sections of your UI Page so we can verify it.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Did you verify by adding alert?

what value it is giving?

is it empty or undefined?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader