How to default a text box to display current year

anjiadmin
Tera Expert

How to default a text box to display current year.

Thanks,

Anji

11 REPLIES 11

Mateen
Giga Guru

You can use an javascript object to get year. Create an onLoad client script and add this code to update a field say 'abc'



var today = new Date();


var year = today.getFullYear();


g_form.setValue('abc',year);




Mateen


Inactive_Us1474
Giga Guru

Hi Anji,



In the default option you can add the value as below :


javascript:(new GlideDateTime()).getYear();



Hit Like/Helpful/Correct, if applicable.