1

I am using jquery.validate plugin. I have a html form inside jquery ui dialog. When user open the dialog and try to submit the form and if form contains validation error and at the same time if user close the dialog and when he open it again than validation messages are still there. I have created a fiddle also :

http://jsbin.com/aralur/4/edit

How to solve this issue ?

Tom Rider
  • 2,747
  • 7
  • 42
  • 65

3 Answers3

1

just use this way:

$('.ui-icon-closethick').click(function(){
    $('.error').text('');
});

and see that in the working bin here -

http://jsbin.com/aralur/5/edit

.

Jai
  • 74,255
  • 12
  • 74
  • 103
  • Acceptance of the answer is required if this helped you to achieve your result. Any more suggestions are welcome. – Jai Dec 06 '12 at 10:02
0

Just hide the error message before opening the dialog box as given below :) It's a simplistic way of doing this.

$("#order").bind("click", function(){ 
  $("label.error").hide();
  $("#orderform").dialog("open");
});
Umesh Patil
  • 10,475
  • 16
  • 52
  • 80
0

Thanks for answers, i also found a solution for the problem which i want to share with you . We can use a resetForm() function of jquery.validate plugin at beforeClose event of jquery ui dialog. Here`s a working fiddle :

http://jsbin.com/aralur/11/edit

Tom Rider
  • 2,747
  • 7
  • 42
  • 65