Link to home
Start Free TrialLog in
Avatar of Andy Green
Andy GreenFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Strange behaviour with ValidatorEnable function

I'm having some strange behaviours with the jQuery ValidatorEnable.

What's happening is this:

When the page first loads the validator is disabled, when I select that part of the page I run

				function toggleAppointment(visible) {
					document.getElementById("pnlBookAppointment").style.display = visible ? 'block' : 'none';
					ValidatorEnable($get('rfvBookAppointment'), visible);
					ValidatorEnable($get('rfvApptIn'), visible);

				}

Open in new window

Where rfvApptIn is my validator control and visible = true, this enables the validator control
Page works OK.


There are a set of radio buttons that if I select one runs a JS function to clear the number text box, and re enables the validator control (may have been disabled elsewhere)

				function toggleBookAppt() {
					var txt = document.getElementById('txtAppointmentIn');
					$('#txtAppointmentIn').val("");
					//Removed the validation if Next Available is selected
					if ((document.getElementById('rdoApptIn_3').checked) || (document.getElementById('rdoApptIn_4').checked)) {
						ValidatorEnable($get('rfvApptIn'), false);
						$('#txtAppointmentIn').prop("disabled", true);
					} else {
						txt.focus();
						ValidatorEnable($get('rfvApptIn'), true);
						$('#txtAppointmentIn').prop("disabled", false);
					}
				}

Open in new window


Now after this the validator fails if I input the same number as previous. but if I type in a new number its OK. ALso the validator doesn't respond straight away, rather it waits for the submit before showing.

I have attached a small video showing this.

Why should enabling the validator control cause this?

I know its not a working example of code but hopefully some one has seen this before.

Andy
JS-Issue.mp4
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial