Hello,
I'm looking for a JavaScript script which will check if 5 different fields in a form are filled in.
My form contains the following 5 mandatory fields.
CheckBox field
Variable name : TestCheckBox
RadioButton field
Variable name : TestRadioButton
there are 4 radiobuttons in the form, all have the same TestRadioButton variable name.
TextField field
Variable name : TestTextField
ComboBox field
Variable name : TestComboBox
ComboBox with user entry field
Variable name : ComboBoxUserEntry
What i want to do is the following.
I need a script which checks if all different 5 fields are filled in.
If one (or more) are not a message like "CheckBox 'TestCheckBox' not filled in" has to be displayed.
The script will be invoked when the user clicks on the "Check form" button.
Can someone please show me how to build a script like that ?
Thanks :-)
Flash
I was going to suggest a general code to verify text, radio and lists, but if you require custom validation (like a text field that must be filled if a check-box is ticked), then maybe you're better off just doing it manually.
Something like:
var msg = "";
if (getField("text1").value=="")
msg+="You must fill in \"text1\".\n";
// ... etc. for the other fields ...
if (msg=="") app.alert("Everything is fine!",3);
else app.alert(msg);
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com