This topic is locked

Required field dependency

7/27/2010 1:35:01 PM
PHPRunner General questions
K
kkiboo author

I'm wondering if this is possible:
I have a form to insert a new record (row) into the database. There are several fields, but depending on what is chosen in the Department column, not all of the other fields are necessary. Is it possible to make the required fields be dependent on what the value of the Department column is?

A
ann 7/28/2010

Hi,
use JavaScript Onload event on the Events tab for the Add page.

Here is just a sample:

var ctrl1 = Runner.getControl(pageid, 'FieldName1');

var ctrl2 = Runner.getControl(pageid, 'FieldName2');

if (ctrl1.getValue()=='Necessary'){

ctrl2.addValidation("IsRequired");

}



More information:

http://xlinesoft.com/phprunner/docs/javascript_api.htm