Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Date Field formatting with action on Enter Event

Avatar

Avatar
Boost 1
Level 2
daveeSYE
Level 2

Like

1 like

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 2
daveeSYE
Level 2

Like

1 like

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
daveeSYE
Level 2

22-03-2012

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?

Replies

Avatar

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile
Niall_O_Donovan
Level 10

22-03-2012

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

Avatar

Avatar
Boost 1
Level 2
daveeSYE
Level 2

Like

1 like

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 2
daveeSYE
Level 2

Like

1 like

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
daveeSYE
Level 2

22-03-2012

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.

Avatar

Avatar
Boost 1
Level 2
daveeSYE
Level 2

Like

1 like

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 2
daveeSYE
Level 2

Like

1 like

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
daveeSYE
Level 2

22-03-2012

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());