This topic is locked

Change Required Field at runtime

3/22/2010 9:00:26 AM
PHPRunner General questions
A
aalekizoglou author

Hi,
is there a way i can change the required fields at runtime?
eg. I have a checkbox and when it's value is on I want to have different fields as required than when it is off.
Up to now I have in the onload event of my table


var tName = 'churchcalendar';
var ctrlbMoveable = Runner.controls.ControlManager.getAt(tName, pageid, 'bMoveable');

var ctrliDays = Runner.controls.ControlManager.getAt(tName, pageid, 'iDays');

var ctrliMonth = Runner.controls.ControlManager.getAt(tName, pageid, 'iMonth');

var ctrliDay = Runner.controls.ControlManager.getAt(tName, pageid, 'iDay');
if (ctrlbMoveable.getValue() == 'on'){

ctrliDays.setEnabled();

ctrliMonth.setValue('');

ctrliMonth.setDisabled();

ctrliDay.setDisabled();

ctrliDay.setValue('');

}else{

ctrliDays.setValue('');

ctrliDays.setDisabled();

ctrliMonth.setEnabled();

ctrliDay.setEnabled();

}
ctrlbMoveable.on('change', function(e){

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

ctrliDays.setEnabled();

ctrliMonth.setValue('');

ctrliMonth.setDisabled();

ctrliDay.setValue('');

ctrliDay.setDisabled();

}else{

ctrliDays.setValue('');

ctrliDays.setDisabled();

ctrliMonth.setEnabled();

ctrliDay.setEnabled();

}

});
A
aalekizoglou author 3/24/2010



Athanasios,
here is a sample:

http://www.asprunner...-editadd-pages/


Jane,
great. It did the job.
Though when changing the required field at runtime the red * is not shown/hidden. I don't know if this would be an option.