Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to clear validation messages
Message
 
 
To
12/04/2013 13:31:59
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
Javascript
Category:
JQuery
Miscellaneous
Thread ID:
01570813
Message ID:
01570818
Views:
24
>>Hi everybody,
>>
>>Right now I am observing the following behavior:
>>
>>1. I invoke my Edit form and make few validation errors to see validation messages
>>
>>2. I close the form without saving
>>
>>3. I open a new form and all validation messages are still here.
>>
>>I think my code is supposed to reset them - what do I miss?
>>
>>
>>var validator = $("#add-edit-form").validate();
>>
>>var $dlg = $("#add-edit-dialog").dialog({
>>   autoOpen: false,
>>   show: "blind",
>>   closeOnEscape: true,
>>   resizable: true,
>>   width: 1200,
>>   height: 750,
>>   minHeight: 600,
>>   minWidth: 950,
>>   buttons: {
>>      Save: function () {
>>
>>         if ($("#add-edit-form").valid()) {
>>
>>            var urlLoc = '/Client/Edit/' + currentId;
>>            if ($('#fntype').val() === "Add")
>>               urlLoc = '/Client/Add';
>>           
>>            var form = $('form', this);
>>            //debugger;
>>            var oForm = form.serialize() + '&';
>>            oForm = oForm.concat($('#frmClientsSearch').serialize());
>>
>>            $.ajax({
>>               type: 'POST',
>>               url: urlLoc,
>>               data: oForm,
>>               dataType: 'json',
>>             
>>               cache: false,
>>               //contentType: 'application/json',
>>               success: function (result) {
>>                  
>>                  $('#flexClients').flexAddData(result);
>>               }
>>            });
>>            $(this).dialog('close');
>>         } else return false;
>>
>>      },
>>      Cancel: function () {
>>         $(this).dialog("close");
>>         clearForm();
>>         if (validator)
>>            validator.resetForm();
>>      }
>>   },
>>   close: function () { clearForm(); },
>>   open: function () {
>>   }
>>});
>>
>>Thanks a lot in advance.
>
>SWAG...how about destroying the dialog?

What do you mean by destroying?

BTW, I was just reading this

http://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages

I may try some ideas from that discussion.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform