Skip navigation
tyguyone
Currently Being Moderated

Auto-fill date when field selected

Jun 22, 2012 8:59 AM

Tags: #javascript #acrobat-forms #acrobat_forms

Hi there,

 

I am looking to have the date (in the format of Day-Month-Year) be auto inserted into my PDF form using Javascript.  Currently, I have the date being added as read-only text, but when the form is cleared the date disappears.  I need the date to stay.  I think the best way to do this would be to have the date populate itself once the user clicks on the date field.

 

Can anyone help me with this please?

 

Thanks,

Tyler

 
Replies
  • Currently Being Moderated
    Jun 22, 2012 9:06 AM   in reply to tyguyone

    You need to fill in both the value and the default values for the field.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 22, 2012 9:13 AM   in reply to tyguyone

    The field object has a "value" property and the value of a field will be cleared on a form reset. The field object also has a "defaultValue" property.

     

    You need to add a new line to the script that if filling in your date field that is exactly like the line that fills in the date value but uses the "defaultValue" instead or the"value" property.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points