How to auto populate catalog item variable with current date

WP2
Kilo Guru

Hi ALL,

I have a variable with Date Type and I want the variable to auto populate current date. I used onChange client script with below script but no date populated. Could you please help with a script to achieve this requirement. Thank you.

var dFormat = g_user_date_format;

var tdayDate = formatDate(new Date(),dFormat);


g_form.setValue('todayDate', tdayDate);

1 ACCEPTED SOLUTION

Utpal Dutta1
Mega Guru

Hey Rich,

 

Go to variable dictionary (right click on the variable) and in default value write this: javascript:gs.nowDateTime()

 

 

If it works the please mark my answer Correct and Helpful.

 

 

Thanks and Regards:

Utpal Dutta 

View solution in original post

10 REPLIES 10

Gowrisankar Sat
Tera Guru

 Put this in Default Value of the variable:

javascript:gs.nowDateTime()