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

How to make all fields in a ROW of a table Required

aafzal_khan
Registered: Mar 6 2009
Posts: 3

Hello All.

Livecycle designer 8.0

I have dynamic table (myTable) and it has four fields Name,SSN,Telephone,email. In runtime the table would have 10 rows by default.

How to make the user enter all fields. i.e if he enters atleast one field then all the other fields should be made required. Example if he enters Name , then he should enter SSN,Telephone,email is a must.

But other rows could have all null values.

Thanks for any input.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
This requires some tricky scripting. First, you have to detect if a change has been make in any field, then set the mandatory propery for the other elements. The most efficient way to do this is to drive the process from the fields themselves.

So, First you need a function, attached to the table row subform that tests all of the fields in the row for a non-empty value, and does the mandatory setting.

Then, in the validate event for each of the text fields in the row, place code that calls this function.

A text field empty test should be something like this.

if( (textField.rawValue != null) && !/^\s*$/.test(textField.rawValue) )
{
// Field is non-empty
}

The validate event is perfect since the data is in the process of being commited and availible in the "rawValue" property of the field. But since this is the "Validate" event, you must place this line at the end of the script

true;

So that the entry isn't inadvertantly invalidated.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

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