Highlighted

Automatically displaying date and time in a date/time field on form initialize

Avatar

Avatar

donn44157260

Avatar

donn44157260

donn44157260

21-12-2011

Good day all;

I am trying to have the current date and time automatically be generated in a “date/time” field when the form is opened.

I went through the forum and found an entry from Srini “ xfa.host.messageBox("" + Date());” . Of course this brought up a system message box with the date and time.

I then tried “DateTimeField1.rawValue = (“”+date())… This also gave me a system message box with the date and time…

Please let me know where I am going wrong

Chomp

Replies

Highlighted

Avatar

Avatar

donn44157260

Avatar

donn44157260

donn44157260

21-12-2011

Found the answer... And yes... in was in the "help" section... What can I say I was making it a lot more crazy than I needed to.

You can use a date/time field to automatically show the current date by using the Runtime Property option in the Value tab of the Object palette.

When using a current date field, the date updates to reflect the system’s current date each time a user opens the form.

1.

In the Library palette, click the Standard category and drag a Date/Time Field object onto the form design.

2.

In the Object palette, click the Value tab and select Calculated - Read Only from the Type list.

3.

Select the Runtime Property option.

4.

View the form in the Preview PDF tab.