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

help with poput on required field

smilem
Registered: Apr 1 2008
Posts: 101

I have modified code from here:

http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=13246

I have set the Text field and dropdown to "User Entered - Required".
I have a textbox and dropdown field that I need to check for null data.
I pasted the code on my button click event:

// These are the required fields on the form.
// Populate array with their names.
var requiredFields = new Array(2);
requiredFields[0] = "TextField1_4";
requiredFields[1] = "DropDownList2_4";

// These are the alert messages shown when a required field is empty.
// Populate array with messages.
// Make sure there's one message for each required field.
var alertMsg = new Array(2);
alertMsg[0] = "Enter device name.";
alertMsg[1] = "Specify Rendering Intent.";

// Regular expression. It means start at beginning of string, look for any single
// white space char, one or more times, to the end of the string.
var emptyTest = /^\s*$/;

var fieldCount = requiredFields.length
var fld = 0;

for (var i=0; i < fieldCount; i++)
{
fld = this.getField(requiredFields[i]);
if( emptyTest.test(fld.value) ) // if required field is empty
{
app.alert(alertMsg[i]);
fld.setFocus();
break;
}
}

I do not get any popup mesages.

My Product Information:
LiveCycle Designer, Windows
smilem
Registered: Apr 1 2008
Posts: 101
Anyone?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You are using AcroForm JS on a LiveCycle form. This will only work if the field names are exactly correct(not the same as the LC names) and the form is saved as static. But regardless, you should really be using LiveCycle JS.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script