Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove "please fill out this field" pop up when click on submit form in angularjs but other validations should work

I want to remove the "please fill out this field" pop-up as validation and normal validations which are declared should display.

Html:

<div class="panel-body">
    <form role="form" id="createForm" v name="createForm"  ng-submit="createAdminGroup(adminGroupData)">
        <div class="form-group" ng-class="{ 'has-error' : createForm.firstName.$invalid && !createForm.firstName.$pristine}">
            <label class="label1">First Name</label>
            <input name="firstName" id="firstName" class="form-control" placeholder="First Name" name="firstName"  type="text" ng-model="adminGroupData.firstName  " required/>
         <span style="color:red" ng-show="createForm.firstName.$invalid  && !createForm.firstName.$pristine">Please enter first name</span>
        </div>

        <div class="form-group">
            <label class="label1">Last Name </label>
            <input name="lastName" id="lastName" class="form-control" placeholder="Last Name" name="lastNmae"  type="text" ng-model="adminGroupData.lastName" />
        </div>

        <div class="form-group">
            <label class="label1"> Email Id </label>
            <input type="email" name="email" id="email" class="form-control"  placeholder="[email protected]" value=""ng-model="adminGroupData.email"/>
        </div>
        <div class="form-group">
            <label class="label1"> Password </label>
            <input name="password" id="password" class="form-control" placeholder="password"  value=""  ng-model="adminGroupData.password" />
        </div>

        <button name="submit" type="submit" class="btn btn-success" id="" ng-disabled="userForm.$invalid">Save</button>
        <button class="btn btn-default" id="cancel" type="button" onclick='handleCancelCreateAdmin()'> Back </button>

        </form>
</div>
like image 310
Priyanka Maurya Avatar asked Oct 08 '15 11:10

Priyanka Maurya


2 Answers

Add novalidate attribute to your form to disable browser default validation

For Ex

<form role="form" novalidate id="createForm" v name="createForm"  ng-submit="createAdminGroup(adminGroupData)">

Find more here

like image 112
Guruprasad J Rao Avatar answered Sep 24 '22 10:09

Guruprasad J Rao


I just tried this and it worked:

oninvalid="this.setCustomValidity(' ')" oninput="this.setCustomValidity('')" >

I have add a space between the two single quotes.

Since i added a bootstrap tooltip on my input fields and required, the invalid input comes to focus and displays the tooltip value.

It was simpler than I thought it would be.

like image 26
guy Avatar answered Sep 24 '22 10:09

guy