Skip navigation
anuddaone
Currently Being Moderated

Autofill value that can be changed

Aug 15, 2012 11:30 AM

Tags: #acrobat-form #acrobat_9_pro

I am pretty new to PDF forms and all things java and am still having a difficult time figuring out what I can and cannot accomplish in these forms...so I thought I would just ask the question this time...

 

What I would like to do is have a the value entered in one field (FromDept) be auto-populated into another field (ToDept) but then I would still like the ToDept field to be able to be changed if the user needs to change it.

 

For this form, these field are very often the same but sometimes they do need to be different - usually the user will just skip this field if it is not changing but we would really prefer the form look complete (though I don't want to force completion of this field - thus my question).

 

I thought it would be some sort of Custom Validation script but have not found anything that fits my needs in the forums after a lot of searching.

 

Is this something that can be done with relative ease or is it more complicated than I need to get for something that is just on a "nice to have" list? 

 

Any help would be greatly appreciated.

 

Thanks!

 
Replies
  • George Johnson
    9,208 posts
    Aug 11, 2002
    Currently Being Moderated
    Aug 15, 2012 11:37 AM   in reply to anuddaone

    The custom validate script for the FromDept field could be as simple as:

     

    getField("ToDept").value = event.value;

     

     

    This will set the ToDept field value whenever the FromDept value changes.

     

     

    You could also set it up so that the ToDept value only gets set if it is blank:

     

    var f = getField("ToDept");

     

    if (!f.valueAsString) f.value = event.value;

     

     

    This way, an existing entry in ToDept won't get overwritten if the user goes back and changes the FromDept value.

     
    |
    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