This topic is locked

JavaScript Help

7/26/2016 11:08:14 AM
ASPRunner.NET General questions
jadach authorDevClub member

I have a check box on an add and edit page. The check box is a bit field in SQL Server.

I want to make a dropdown on the add or edit page required if the check box is checked.

I have it somewhat working whereas when checked, the dropdown does become required (good). Now when you uncheck, it remains required (not good).

How can I get this to work? Here is my JavaScript.
var ctrlLandingPageID = Runner.getControl(pageid, 'LandingPageID');

var ctrlSeminarVideo = Runner.getControl(pageid, 'SeminarVideo');
ctrlSeminarVideo.on('change', function(e){
if (this.getValue() == 'on'){

ctrlLandingPageID.addValidation("IsRequired");

}

else{

ctrlLandingPageID.removeValidation("IsRequired");

}
});
Thanks

Sergey Kornilov admin 7/27/2016

The code looks good to me. If you need us to troublehsoot it feel free to post it to Demo Account and we'll take a look.

jadach authorDevClub member 7/27/2016

Ticket in and a sample is out on demo.

Thanks

Pete K 8/3/2016

Jerry, just throwing this out in case it helps. I have had a few frustrating episodes with JavaScript code in ASPR apps -- usually involving custom button events. I finally figured out that changes to my code were often not being implemented in the browser because of script caching. I have gotten in the habit now of flushing my browser cache after editing JS.

jadach authorDevClub member 8/3/2016

Good point. However, in this case Xlinesoft said it was on their end and will fix with next release.

Pete K 8/4/2016

Great.

Sergey Kornilov admin 8/16/2016

This should have been fixed in build 26950 as well

jadach authorDevClub member 8/17/2016

Thanks Sergey, it's appreciated!