Tom Söderlund
Tom Söderlund

Reputation: 4747

Catch form submit event in AngularJS, although form validation failed

I have a payment form where I want to listen to the form submit event for metrics purposes, even though the form validation failed (I want to see intentions of paying).

My form header:

<form id="payment-form" class="form-with-validation" name="paymentForm" ng-submit="submitPaymentForm()">

I do have required on some form fields.

But even I keep the Submit button as always enabled, Angular catches the event and submitPaymentForm() never triggers:

AngularJS form

What to do?

Upvotes: 0

Views: 566

Answers (1)

Kalhan.Toress
Kalhan.Toress

Reputation: 21901

add novalidate like below. Note that novalidate is used to disable browser's native form validation.

<form id="payment-form" novalidate ... 

Upvotes: 1

Related Questions