0

In my JSP code, I try to use ng-submit on a form.

The problem is that there are many validations for the textboxes of that form which are implemented using ng-disabled in Submit button.

Now if I click enter key on a textbox then those validations will not be implemented and the form will be submitted.

How can I add the conditions here?

The only option I could think is to move all the conditions of ng-disabled to Javascript function.

<form name="customersForm" ng-submit="findCustomers(custName, custCity)">

    <button type=submit **ng-disabled="validateInputs(custName,custCity)"**  
id="listButton" ng-click="findCustomers(custName,custCity)"><span>Find </span></button>
user2369634
  • 897
  • 3
  • 9
  • 17

1 Answers1

0

Add the novalidate attribute to your form and add the required attribute to your form elements. From there, you can play with the validation of your form with the ng- directives. The form wont be submitted until all the fields are properly filled.