Hi i am using jquery validator plugin to validate my form.
In my form, the field "numero_commissione" must contains a non-
negative number and this must not be in use. So i use a remote
validation in order to accomplish this.
The problem occurs when i want to modify an item. The edit page shows
the form filled with the values of the item. If no change were made,
the first click on the submit button cause the validation of the
remote field (i see it in the console of firebug) and only the second
click cause the submit of the form.

The main piece of code is this:

        var validatorEdit = $("#form_edit_commissione").validate({
                rules: {
                        numero_commissione: {
                                required: true,
                                number: true,
                                min: 1,

                                remote: {
                                url: "/admin/commissione/check/op/edit",
                                type: "get",
                                data: {
                                                numero_commissione: function() {
                                                        return 
$("#e_numero_commissione").val();
                                                },
                                                vecchio_numero_commissione: 
function() {
                                                       return $
("#vecchio_numero_commissione").val();
                                               }
                                        }
                                }
                        },

                        presidente: { required: true },
                        medico_lavoro: { required: true },
                        medico_categoria: { required: true },
                        medico_specialista: { required: true }
                },
                messages: {
                        numero_commissione: {
                                remote: "Numero di commissione giĆ  in uso"
                        }
                }
        });


I try to use the option submitHandler, but i get the javascript error
"form.submit is not a function":

$(".selector").validate({
   submitHandler: function(form) {
       // do other stuff for a valid form
        form.submit();
   }
})

Thank in advance. Hello from Italy

Reply via email to