0

I am looking to validate a form and disable the submit based on no form errors. I am leveraging UI Utils. The email validation, password matching and password message works, just not the submit.

<div class="modal-body" ng-controller="registerFormController">
    <div class="facebookButton">
        <div class="lucida">Sign In With Facebook</div>
    </div>

    <form ng-submit="processForm()" name="registerForm" name="password" class="registerForm">
        <input type="email" placeholder="Email" class="registerEmail block" ng-model="formData.email">

        <input type="password" placeholder="password" required class="registerPassword block" ng-model="formData.password">

        <input type="password" placeholder="password" name="password2" required ui-validate=" '$value==formData.password' " ui-validate-watch=" 'formData.password' "class="registerPassword2 block" ng-model="formData.password2">

        <span ng-show="registerForm.password2.$error.validator">Passwords do not match!</span>


        <button type="submit" class="create-account" ng-disabled="'!registerForm.$error.validator'">Create Account</button>
    </form>
</div>

If a CodePen / PLNKR or any additional code is needed, I can definitely provide. Thanks a bunch in advance.

1 Answer 1

1

You need change your mark up to this:

<button type="submit" class="create-account" ng-disabled="registerForm.$invalid">Create Account</button>

You also need to remove this from the form tag:

name="password" 
Sign up to request clarification or add additional context in comments.

1 Comment

not sure why "name=password" was there. Worked! Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.