Expand my Community achievements bar.

Auto fill system date

Avatar

Level 4
I'd like to be able to have the system date (YYYY MM DD format) automatically fill in a date field.



Also this data should stay fixed if the PDF is saved. For example, the user fills in the form and saves a copy with the system date of that day. However when the user re-opens the PDF next week the original system date should still be there (not replaced by the current system date).



Can any provide me with the code to do this? Thanks.
7 Replies

Avatar

Former Community Member
Bet,



The javascript that you will need is:



if (DateTimeField1.rawValue == null)

{

Now = new Date();

DateTimeField1.rawValue = Now.getYear()+1900 + "/" +(Now.getMonth()+1) + "/" + Now.getDate();

}



Note: The DateTimeField1 has to be readonly type. This will prevent the users from modify the value in this field.

Avatar

Level 4
Woo hooooo! It works great.



Thanks jimmypha. You are the best!!

Avatar

Former Community Member
Any way to make the drop down button disappear?

Avatar

Former Community Member
SGreen,



You can use a text field instead of the DateTimeField.

Avatar

Level 4
The script in the field is still running perfectly. However I've run into a bit of a snag. When someone hits the RESET button is it possible to exclude this field (or any field) from that action?

Avatar

Former Community Member
Bet,



I think this question is the same as the question that you ask in the other post.



Click
here to go to your other post.

Avatar

Former Community Member
I am using Adobe 8 Professional and want to be able to set two of the form fields I've created to automatically enter the current date in these fields. Once that date is created, I don't want it to be changeable by anyone else receiving the form. Can anyone help me?