johannesjo / ng-fab-form

Convenient forms for Angular with no extra markup? Fabulous!
https://johannesjo.github.io/ng-fab-form
MIT License
172 stars 25 forks source link

Fire validation mechanism for single input #85

Closed mgbarnech closed 8 years ago

mgbarnech commented 8 years ago

Hi First of all sorry for my English I wonder if there is a possibility of firing mechanisms validation on a particular input from a controller. This is because I have a form in two steps and I need to validate and show the errors of the fields in the first step I understand that currently validations occur in the submit, but in my case the submit occurs in the second step

Thanks

johannesjo commented 8 years ago

Do I understand you correctly and you're talking about a form split on two pages? You could always do:

<form>
<div ng-show="formStep===1"><button type="button" click="formStep=2">bla</button></div>

<div ng-show="formStep===2">...
<button type="submit">Submit<button>
</div>
</form>

It's a little bit more complicated than that, but I'm sure you will figure it out. You might also want to try using ng-form, which should be supported by ng-fab-form.

From a usability perspective I would recommend to do the validation on the first step right away. It feels stupid to be thrown back to a previous step after I completed the second.

mgbarnech commented 8 years ago

Right. I meant a form split on two pages Use ng-form and worked well except for the fact that no error messages displayed in the inputs they had failed To display these messages had to set on controller as $touched=true those inputs

Thanks for the help!!

johannesjo commented 8 years ago

You're welcome :)