Question

I am currently developing an App with Laravel and I am doing the Form Validation with Parsley (http://parsleyjs.org/) instead of Laravel so the forms get checked before even send.

This works without any issues except the Password validation. I have 2 Password fields and I want to validate them against each other with "parsley-equalto" but still can type different values in each field and it gets validated. Only the equalto functions seems to not work.

<form method="POST" action="http://127.0.0.1/laravel/register" accept-charset="UTF-8" class="form-horizontal" id="parsleyForm">

    <div class="form-group">
        <div class="col-sm-6">
            <input type="password" class="form-control" required placeholder="Password" parsley-trigger="change" id="password">
        </div>

        <div class="col-sm-6">
            <input type="password" class="form-control" required parsley-equalto="#password" parsley-trigger="change" placeholder="Re-Type Password">
        </div>
    </div>

</form>

<script>
$(document).ready(function() {
    if ($('#parsleyForm').length != 0) {
        $('#parsleyForm').parsley();
    }
});
</script>

Does anyone have an idea were the problem could be?

Était-ce utile?

La solution

Which Parsley version do you use?

Your DOM attributes seems to indicate you use 1.x version, you'd better try 2.x version, which uses rather data-parsley-equalto attribute.

Best

EDIT: I'm reposting here my comment that solved your question, because I don't like to see unanswered questions under Parsley tag :)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top