Quantcast
Channel: Adobe Community: Message List - PDF Forms
Viewing all articles
Browse latest Browse all 57214

Required fields Adobe XI forms

$
0
0

Hello,

I'm new in JVS and I need a little of help from you guys.

I have a form created with Adobe XI with some required fields. The only thing I found on the forum to actually force the user to fill-up these fields was to add a JVS code to a button to popup a message that tell to the user that the field …this …and this… and this… need to be filled. The code looks like:

 

var emptyFields = [];

for (var i=0; i<this.numFields; i++) {

var f= this.getField(this.getNthFieldName(i));

if (f.type!="button" && f.required ) {

if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off")) emptyFields.push(f.name);

}

}

if (emptyFields.length>0) {

app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n"));

}


 

What I want to do is when the user will finish to fill-up the entire form he'll press a button which will validate the form (above code) and then trigger a save us dialog.

My question is how to link to the existing code, another code for save us function, which will pop up the save us dialog ONLY if the user filled up the entire form, otherwise will give the message error from the java script.

 

NOTE: I tried with Button Proprieties / Action menu and added ON FOCUS the above JavaScript code and then Execute a menu / Save us….but this will pop up the error if the required fields are empty and also the save us dialog regardless the user will fix or not the empty fields .

 

Your help is much appreciated,

Adrian,


Viewing all articles
Browse latest Browse all 57214

Trending Articles