Copy link to clipboard
Copied
Hi,
I have two unique form fields.
I am attaching a screen shot of the form fields.
The first form field is called #1.
The second form field is called #2.
The third form field is called #3.
When someone enters an answer into EITHER #1 OR #2, i want that answer to be pre-populated to #3. If #1 is blank, but #2 has a response, then that response goes into #3.
Same is true if #2 is left but #1 has a response, then that response should go to #3.
How can i accomplish this? I am using Adobe Acrobat Pro DC. If there is coding i need to put, where and how do i do this?
Copy link to clipboard
Copied
What happen if both fields are filled?
You can use this as custom calculation of "#3" field:
var a = this.getField("#1").value;
var b = this.getField("#2").value;
if(a &&!b)
event.value = a;
else if(!a && b)
event.value = b;
else
event.value = "";
Copy link to clipboard
Copied
where do i enter this code? can you provide screen shots?
both fields will not be filled in, either one of the fields will be filled in, that's how the questions is designed, the user should not be answering both questions.
Copy link to clipboard
Copied
Select 'Prepare form' tool -> right click "#3" field and select properties, click on 'Calculate' tab -> select 'Custom calculation script' -> click on 'Edit' -> paste script in the Javascript editor and click 'Ok'.