Jump to content

change Drop down validation to field validation


evr72

Recommended Posts

Hello, I am new to the wonderful world of programming. I have been working a bit with some JavaScripts and ASP pages. I have a script that checks the value of a drop down field and tells the user if another field is required or not, this works great, but when I change the dropdown box to a regular field the script does not work and not sure why, I was wondering if anybody could give me some advice or point me in the right direcction. Here is the script

function OnPageLoadEdit(pageid){var tName = 'answers';var ctrlkeycontrol = Runner.controls.ControlManager.getAt(tName, pageid, 'keycontrol');var ctrlresp = Runner.controls.ControlManager.getAt(tName, pageid,'resp');var ctrlexplain= Runner.controls.ControlManager.getAt(tName, pageid,'explain');var ctrliscontroldocumented = Runner.controls.ControlManager.getAt(tName, pageid,'iscontroldocumented');var ctrlnarrativeofcontrol = Runner.controls.ControlManager.getAt(tName, pageid,'narrativeofcontrol');var ctrlfrequency = Runner.controls.ControlManager.getAt(tName, pageid,'frequency');var ctrlpersonresponsable = Runner.controls.ControlManager.getAt(tName, pageid,'personresponsable');var ctrlmanualorautomated = Runner.controls.ControlManager.getAt(tName, pageid,'manualorautomated');ctrlkeycontrol.on('change', function(e){	 if (this.getValue() == 'X'){			   ctrlresp.addValidation("IsRequired"); ctrlexplain.addValidation("IsRequired");ctrliscontroldocumented.addValidation("IsRequired"); ctrlnarrativeofcontrol.addValidation("IsRequired"); ctrlfrequency.addValidation("IsRequired"); ctrlpersonresponsable.addValidation("IsRequired"); ctrlmanualorautomated.addValidation("IsRequired");	 }});}

I have tried to change the ctrlkeycontrol.on('change', function but no luck

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...