我正在构建一个表单,并且在该表单中是我希望运行的辅助功能。但是,当我点击我的辅助功能按钮时,骨干会触发并在整个表单上运行验证。我怎么可以:让Backbone忽略一个按钮或按钮类型
a)使骨干忽略的特定按键和一筹莫展的时候,它的点击
或
B)(首选)领带骨干验证,只有形式提交按钮或按键式“提交”。
例子:
<form name="myForm" >
<input type="text" name="yourName" ng-model="yourName" required />
<input type="text" name="postcode" ng-model="postcode" required />
<button id="checkPostcode" type="button" >Check Postcode</button>
<button id="submit" type="submit" >Submit</button>
</form>
在这种情况下,我只希望骨干按下提交按钮时运行验证,这样我就可以无干扰运行我checkPostcode功能。
谢谢:)
谢谢,这做到了。 – xgoodvibesx