Form validation not work and submitting form even there is null values

40 views Asked by At

I am trying the following code to check errors but its submitting form even the form is empty. Please advise what should I do? I have copy pasted as it is to get expert advice. Please help me to fix this form

    <form method="POST" action="/adminLogin"
        class="form-width form-horizontal main-form needs-validation"
        novalidate>
        <h3 class="form-title">Administrator Login</h3>
        <div class="form-group">
            <label>Email</label>
            <div class="input-group" id="idEmail">
                <div class="input-group-prepend">
                    <span class="input-group-text"><i class="fa fa-envelope"></i></span>
                </div>
                <input class="form-control" name="email" type="email"
                    value="[email protected]" id="idEmail-1"
                    pattern="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?">
                <div class="invalid-feedback">Email format is not correct or
                    is not in English Language</div>
            </div>
        </div>
        <div class="form-group">
            <label>Password</label>
            <div class="input-group" id="">
                <input class="form-control" name="password" type="password"
                    value="sss" id="password">
                <div class="input-group-append">
                    <span class="input-group-text"> <a href="#"
                        class="toggle_hide_password"><i class="fa fa-eye-slash"></i></a>
                    </span>
                </div>
                <div class="invalid-feedback">Password format is not correct
                    or is not in English Language</div>
            </div>
        </div>
        <input type="hidden" name="from" value="">
        <input type="hidden" name="userType" value="1">
        <a href="/resetLink"><b><u>Reset Password</b></u></a></br>
        </br>
        <button type="submit" class="btn btn-primary btn-block">Login</button>
    </form>

Thanks

0

There are 0 answers