tags:

views:

45

answers:

1

Hi Friends!

I have a form which have five text boxes. I have applied custom validation using validate.addmethod to 4 textboxes out of above 5 textboxes. The validation is applied to first three text boxes, the fourth textbox dont have any validation, the last text box have the same validation as first three text box. The Validation is working perfect but there is a problem with error message display. The problem is when user enters invalid data in third text box a error message is get displayed for that textbox.and if user continues to enter data further that is keeping invalid data in third text box and continues entering data in fourth text box for which validation is not applied the error message of third text box is remain as it is but as soon as cursor goes to fifth text box the error message of third text box goes off in-spite of the wrong data in that text box. Here I dont understand whats goes wrong there. Please help me to solve this problem Thank You!

+1  A: 

Are you using the same field identifier aka field error name for text box 3 and text box 5 for showing errors? It may be happening that since same validation applies to text 3 and 5 , a mixup of the action fields is happening leading to the previous message getting cleared.

Try if the same happens when invalid data is fed to text 1 and then you come to text 2 or 3.

Also , adding a sample code snippet would help in decoding you problem.

vaibhav bindroo
Thanks thetalkguy! for your answerI found the cause of problem. The problem is due to a silly mistake done by me while writing the code. Actually I had given same id to both text boxes i.e. id of textbox 3 is same as textbox 4 thats why when focus goes from text box 4 to 5 it clears the error message of textbox3 actually it was get overwritten by the textbox4 for which I didnt given any validation and message. But I get puzzled that if i used name given to the textboxes for the validation of them in jquery the how come jquery used id given to textboxes to display error
Param-Ganak