I have placed a date/time field on a form that should show the full date
and time in the format MM/DD/YYYY HH:MM A (03/22/2012 10:05 AM) on the
enter event.
I'm having trouble finding the right combination of object properties and
scripting to display in that format. Using the action builder it will only
set the date (not time) in the format (YYYY-MM-DD), and not in the pattern
I specified in patterns on the the value tab for display and data and you
can't include the time.
If I set the field to calculated, then the field is populated on
initialize, which is not desired as the time has to be accurate to the
minute and should not be populated until the user is ready to "stamp" the
field by clicking in it.
What JS on the enter event of the field would achieve this?
Also, will the enter event still trigger if the field is read only when the
form loads?
Maybe there is a better way to achieve this without the use of a button?
Views
Replies
Total Likes
Hi,
You can set the format at design time by clicking Patterns in the Object > Field palette.
There is an example here for changing the format at runtime, but you probably don't need that if you set up the pattern for the date field in Designer. http://assure.ly/rZQIhn and http://assure.ly/e59VGu.
Hope that helps,
Niall
Views
Replies
Total Likes
Thanks for the quick reply Niall,
What you are suggesting is what I already have. I need it to populate on
the enter event of the field as per the OP. Perhaps also set the field to
read only and set focus to a button.
Can't do it with action builder because there is no option to set the field
value for the current time, only the current date.
Views
Replies
Total Likes
Your comment jogged my mind.
I got it working by putting this in the enter event on the field.
this.resolveNode("$").rawValue = util.printd("mm-dd-yyyy h:MM tt", new Date());
Views
Replies
Total Likes
Views
Likes
Replies