Hi all
I am attempting to use javascript to validate the data submitted by the user. I have a single textbox, a custom validator, and a validation summary control on my page.
User should be able to place a numeric value in the textbox (I'm ignoring alpha characters at the moment), if the value is between 2 and 3, then the value is correct, otherwise I want to set the custom validator to false and display the error message in the validation summary.
I have succeed in displaying the error in a javascript alert box, but I am unsure on how to move on with the custom validator.
Here is the code I am using so far...
Mike55.
I am attempting to use javascript to validate the data submitted by the user. I have a single textbox, a custom validator, and a validation summary control on my page.
User should be able to place a numeric value in the textbox (I'm ignoring alpha characters at the moment), if the value is between 2 and 3, then the value is correct, otherwise I want to set the custom validator to false and display the error message in the validation summary.
I have succeed in displaying the error in a javascript alert box, but I am unsure on how to move on with the custom validator.
Here is the code I am using so far...
Code:
function ValidateData(){
var data = document.getElementById("TextBox1");
if (data.value < 1 || data.value > 3){
alert("Invalid Data");
}
else{
return true;
}
}
Mike55.