I have a form with multiples textbox. One of those textbox has a validator i made. Basicaly, that validator inherits from the CustomValidator class and uses a javascript function to validate the content of the textbox.
The javascript function is quite simple
function myFunction(sender, args) {
if (condition) {
args.IsValid = true;
}
else {
args.IsValid = false;
}
}
If the condition is false, an error message is shown dynamicaly.
So, the problem happens when i enter invalid data in my textbox, because the data is invalid, the message shows. Everything works as expected for now. But, when i go back in my textbox to correct the data, when i click on the submit button, it seems like it triggers the onchange event for the validator, thus hiding the error message but not clicking on the button.
Any idea on why this happens and how to fix it?
Thanks
Answering question with what I said in comments
I solved my problem. The thing was that since my error message is shwon dynamicaly, the submit button “moves” on my page when the error message is shwon/hidden. So, when i clicked on the send button, the error message would disapear, “moving” the button somewhere else then where i clicked, making it so that i would not be actually clicking on the button.
Some complementary information: It seems that the validation occurs on the mouseDown event, and the button click occurs on the mouseUp event. I tested that by clicking the button, holding down the mouse button, pointing back to the button and releasing the mouse button, and the clic worked.