Answered
Hi -
I'm new to Acrobat Forms but have created my first form with a submit (to email) and reset button.
It's a 3-page form. The third page contains 40 text boxes where users can fill in their name next to volunteer activities they are willing to do.
I'd like the form to validate that the user has added his/her name to at least 2 of those 40 volunteer text boxes before I accept them submitting the form to email.
How is this done?
Thanks!
Jeff
For example: Activity1, Activity2, Activity3, etc.
Then you can write a loop like this
var nActivityCount = 0;
for(var i=1;i<41;i++)
{
var fld = this.getField("Activity" + i);
if( (fld != null) && (fld.value != null) && (fld.value.length > 0) )
nActivityCount++;
}
if(nActivityCount > 1)
this.mailForm(...);
else
app.alert("Not enough Activities");
To use this script you'll also need to submit using JavaScript, as shown in the last bit of the script. Place this code in the button Down event of your submit button and delete the current submit action.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script