Contents

 
Home
PHPRunner 8.0 manual
Prev Page Next Page
 
 

Show dropdown list of US states if US was selected in country list

 

To show dropdown list of US states if US was selected in the country list or hide it otherwise, use the following code in Javascript OnLoad event.

yellowbulbNote: Change the values listed in red to match your specific needs.

var ctrlCountry = Runner.getControl(pageid, 'country');

var ctrlState = Runner.getControl(pageid, 'state');

 

ctrlCountry.on('change', function(e){

if (this.getValue() == 'US'){

ctrlState.show();

}else{

ctrlState.hide();

}

});

You may want to hide field label as well. Use the following code to hide or show the whole table row with state edit control based on country field selection:

var ctrlCountry = Runner.getControl(pageid, 'country');

 

ctrlCountry.on('change', function(e){

if (this.getValue() == 'US'){

$("tr[data-fieldname='state']").show();

}else{

$("tr[data-fieldname='state']").hide();

}

});

See also

Converted from CHM to HTML with chm2web Standard 2.85 (unicode)