Completed

Problemas Validação Formulário Utilizando Parsley.js

Published on the October 05, 2015 in IT & Programming

About this project

Open

Estou com um problema em um formulário ao validar utilizando Parsley.js

//Form - Parsley Validate Group
$(document).ready(function () {

    var form = $("form");
    var group = undefined;

    $("form input[type=submit]").click(function () {
        form = $(this).closest("form").attr("id");
        group = $(this).data("parsley-group");

        //$("[data-parsley-required]").find("+ ul li").show();
    });

    form.parsley().subscribe('parsley:form:validate', function (formInstance) {

        var formObj = $(formInstance.$Element);

        if (formInstance.isValid(group, true)) {
            formInstance.submit();
        }

        formInstance.submitEvent.preventDefault();
        return;
    });

    form.parsley().subscribe('parsley:form:validated', function (formInstance) {

        var focus = false;

        $("[data-parsley-required]").each(function (index) {

            //Group Validation
            var thisGroup = $(this).data("parsley-group");

            if (group != thisGroup) {
                $(this).find("+ ul li[class^=parsley-]").hide();
                $(this).removeClass("parsley-error");
            }
            else {
                if (focus == false) {
                    $(this).focus();
                    focus = true;
                }
            }

            //Parsley Errors
            var divInput = $(this).closest("div[class^=col-]");

            if ($(this).hasClass("parsley-error")) {
                divInput.addClass("has-error");
            }
            else {
                divInput.removeClass("has-error");
            }

        });

    });

    form.parsley().subscribe('parsley:field:validated', function (fieldInstance) {

        var fieldObj = $(fieldInstance.$Element);

        //alert(field.attr("name"));

        //alert(fieldInstance.isValid());

        var divInput = $(fieldObj).closest("div[class^=col-]");

        if (fieldInstance.isValid()) {
            divInput.removeClass("has-error");
        }
        else {
            divInput.addClass("has-error");
        }

    });

});

O erro que da é na linha: formInstance.submit();
Ele não efetua o submit e da a mensagem:  formInstance.submit is not a function

Category IT & Programming
Subcategory Web development
Is this a project or a position? Project
I currently have I have specifications
Required availability As needed
Experience in this type of projects Yes (I have managed this kind of project before)
API Integrations Other (Other APIs)
Roles needed Developer

Delivery term: October 06, 2015