I am new to angularJs and currently working on a form validation.
Below is the snapshot of the form:
Task: is to validate the Qty values. Field SX and Qty exist in DB. I am using a webservice on ng-blur of SX and Qty to get the max(Qty) value from the DB table. If the current Qty value is greater than the max(Qty) value of DB table then it should show an OK/Cancel Message box. If Ok it will submit the data to DB and if Cancel it will reset the current value.
Since I am calling the web service on ng-blur, it working perfectly fine when Submit button is clicked but its not working when Enter is clicked.
My question is how to validate my SX and Qty values both on ng-enter and button click i.e. ng-click where I am calling addItems()
?
Also, when I click on the Submit button and if there is any validation there then only the ng-blur function is getting called, I have to click again to call the addItems()
. I want this in single click.
Any immediate suggestions will do a great help.