How do I add default value to date?

I want to add today’s date as a default value to the form. But I am only able to add text as a default value, so I want to know how can I add today’s date as a default value to the form.

Hi Shweta,

The default value is a very powerful feature in Five. It can be just text however if you start the default value with an ‘=’ you can then enter any JavaScript expression you want including references to the five object.

For example if you had one field called FirstName and another called Surname and you would like the default for SortName to be a combination of the two you could put “=five.field.Surname + ', ’ + five.field.FirstName” into the default value for SortName.

To accomplish a default date of today you could just put “=five.now()” and you would get today’s date.

Hope that helps!

Mark

1 Like

Hello Mark,

Thank you for your reply, I will try using this.