jQuery: code to validate before submitting


I’m trying to validate my form before submitting it. I’m trying it with this code below, but it always submit the form values:

$('#gestione_profilo').submit(function () {


        rules: {

            'person_data[document_number]': "required"


        messages: {

            'person_data[document_number]': "required"



    form_data = $(this).serialize();


        url: "<?php echo url_for('profile/index') ?>",
        type: "POST",
        data: form_data,
        success: function() { $("#forma_profile").unmask(); }


        $("#forma_profile").mask("Aggiornando dati...");

        return false;


Any help?



There are quite some jQuery validation Plugins around. Which one is it you’re using?