Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to clear validation messages
Message
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
JQuery
Titre:
How to clear validation messages
Divers
Thread ID:
01570813
Message ID:
01570813
Vues:
48
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.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform