Closed baskaranr closed 7 years ago
You can use <button type="button"></button>
together with this approach to manually trigger a form submit:
http://stackoverflow.com/questions/16003188/can-i-trigger-a-form-submit-from-a-
Does this help you?
Thanks for the quick reply. I tried the solutions mentioned in the stackoverflow link. But those solutions doesn't trigger fab-form validations.
If you trigger the submit, the validation is triggered, isn't it?
yes its working via html.
<form id="item_form" name="item_form" class="form-horizontal" role="form" ng-submit="saveItem()">
but its not working while invoke submit from controller code as mentioned in stackoverflow answers.
Oh that's interesting! I'll have to check this you Out. Could you by any chance provide a plunkr?
Sorry. I have been using this plugin part of project and couldn't able to extract the form code in plunkr
On Oct 12, 2016 10:04 PM, "Johannes Millan" notifications@github.com wrote:
Oh that's interesting! I'll have to check this you Out. Could you by any chance provide a plunkr?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johannesjo/ng-fab-form/issues/91#issuecomment-253266271, or mute the thread https://github.com/notifications/unsubscribe-auth/ADSTZio2XSdjOkE0tDvMpEfBjqs30AnDks5qzQwogaJpZM4KUZVQ .
Hey there. I checked again. To trigger the validation messages (at least with the default validations-tempalte) you can set form controllers $triedSubmit
property to true. Here is an example:
http://plnkr.co/edit/jIGCxuXGIPkB60ZJP0jS?p=preview
Hi,
Thanks for the plnkr. Its very closer to my requirement. The submit doesn't call the respective method if validation fails. In triedsubmit case we have to handle it as like fake submit - 2.
Please check the modified plunkr. http://plnkr.co/edit/qlOgr6n6NPtujff8Wzg8?p=preview
Sorry, Im not sure what the issue is. can you elaborate further?
if(!form.$valid) { return;}
does not solve your problem? Why not?
It solves the problem. but submit button click its handled without this code block.
Sorry, you have to explain a little better what the problem is, you're facing.
sorry, it works as expected. Please go through this fiddle for reference. [Fake submit 1 click and Fake submit 2 click]
I'm glad, that it works!
Hi,
I have two actions in my form "save", "save and approve". So i want to trigger validation manually in both actions instead of form-submit. Please do the needful.
Thanks, Baskar