Skip to main content
Participant
November 3, 2022
Question

Check if dropdown contains "-" or something else

  • November 3, 2022
  • 1 reply
  • 224 views

There is a dropdown menu with the following values:

 

- "-"
- value 1
- Value 2
- Value 3

" - " is a default value and is always displayed first
(comparatively with zero)

 

However, a warning should appear as soon as you have not changed the value " - " to "Value 1, 2 or 3" when you save or exit the PDF. But you are not forced to change the value this is only a warning.

 

As a warning should appear: "Please choose a valid value (- is not a valid value)".

 

Thank you very much for the help!

This topic has been closed for replies.

1 reply

jslesnAuthor
Participant
November 4, 2022

Solved it myself 🙂

 

var f = this.getField("Dropdown1");

if (f.valueAsString=="-") {

    app.alert("You must fill in this field before submitting the file.",3);

    f.setFocus();

} else this.mailDoc();