These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Problems with Required Fields

dallasa
Registered: Jan 9 2009
Posts: 3
Answered

I am setting up a pdf with multiple required fields and cant seem to get the required fields to force entry unless the "SUBMIT" button is used, I want the same function from a "PRINT" button. Is there a way??? By the way the form will be used in READER.

My Product Information:
Acrobat Standard 9.0, Windows
zeborn
Registered: Jan 13 2009
Posts: 6
I'm a novice user but found this post that helped me.

http://forms.stefcameron.com/2008/04/13/prevent-printing-pdf-forms-in-acrobat-8/

It seems to work for me but created other problems by having to use Adobe LiveCycle as I had just converted a Word document to Adobe. It seems to have changed some of my programming in Adobe but does highlight the required fields when I click the Print button now.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
That is the way the "required" property works when the submission is to a scripted web page. If you want to modify that behavior, you will need to create a script to check each required field, handle the missing fields and submtitting only when all required fields are properly completed. You can do this by making an array of required fields or checking each field as a required field.

Unfotunatly the link reference is for a LiveCycle Form and not an Acrobat form. These 2 products are based on very different technologies and are not interchangable on this feature.

See [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=13246]How to validate that 2 of a set of 40 form fields are filled in?[/url] for an example of how to use an array of field names in submit script.

George Kaiser

zeborn
Registered: Jan 13 2009
Posts: 6
Thank you for your help. I looked at the link you provided and got my radio buttons working like I want by adopting your code. My problem now is that I have a pdf form that has 2 user entry text fields for name and case number, then 8 radio buttons all of which are required. Radio buttons are working great but am having trouble writing code to make sure the name and case number are also completed prior to printing the form. I can get Thomp's code working for text fields or yours for radio buttons but can't get both. I'd like form not to print and issue error message if any of the fields are not completed. Any help you can provide would be much appreciated. Here is what I have to make the radio buttons work:

// define array of required field names
var aReqFields = new Array("activity3", "activity4", "activity5", "activity6", "activity7", "activity8", "activity9", "activity10");

var fld;

// some debugging information
console.show();
console.clear();
console.println("Number of required fields: " + aReqFields.length);

var nActivityCount = 0; // clear count
// loop through the required field array
for(var i = 0;i < aReqFields.length; i++) {fld = this.getField(aReqFields[i]); // get field name for i element of array

console.println (i + ": " + fld.value); // more debugging info

if(fld.value != "Off" )
nActivityCount++;
}

console.println('Activity count: ' + nActivityCount); // more debugging info

if(nActivityCount > 7)
app.alert({
cMsg:"You have completed all required fields. Click OK and then click OK in the next window to print.",
nIcon:(3)});
else
app.alert({
cMsg:"You have omitted one or more required fields. Click the CANCEL button to cancel printing. Complete all required fields and then click PRINT again.",
nType:(1)});