gpt4 book ai didi

javascript - 在angularjs中单击提交表单时如何删除弹出的 "please fill out this field"但其他验证应该有效

转载 作者:太空狗 更新时间:2023-10-29 13:35:04 25 4
gpt4 key购买 nike

我想删除“请填写此字段”弹出窗口作为验证和声明的正常验证应该显示。

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@xyz.com" 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>

最佳答案

novalidate 属性添加到您的 form 以禁用浏览器默认验证

对于前任

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

Find more here

关于javascript - 在angularjs中单击提交表单时如何删除弹出的 "please fill out this field"但其他验证应该有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33014889/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com