Skip to main content
Participant
September 21, 2018
Question

Drop down selection validation

  • September 21, 2018
  • 1 reply
  • 1232 views

We are using a pdf as a training document to test users on a web based process.

We want to confirm that users have selected the correct option in the drop down field and if not show a validation to advise them to select to correct response.

We need a custom javascript that reads the "Workflow" field and validates that the response selected is "Level 1 Rebuttal"

Can anyone assist?

The code we have tried is

optionObject.selected

var x=document.getElementById("Level 1 Rebuttal").selected;

optionObject.selected=true/false

We have tried it as an Action on the  drop down field itself as well as the "review form" button on the pdf and neither work if the selection has been changed but is wrong. it only performs the validation if the selection has not changed.

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
September 21, 2018

The JavaScript you've shown is for HTML, not PDF. So are the users selecting a dropdown on a PDF or on an HTML page?

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
missyb4uAuthor
Participant
September 23, 2018

We are using a .PDF

We found this script in our search online and it's obvious that we are newbs.

Any help is appreciated!

Thom Parker
Community Expert
Community Expert
September 23, 2018

Here are a couple of articles that discuss Acrobat JavaScript ist/dropdown programming.

https://acrobatusers.com/tutorials/list_and_combo_in_lc

https://acrobatusers.com/tutorials/change_another_field

And you'll find tons of info and samples here:

https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often