Skip to content

section $valid? #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jakecoffman opened this issue Sep 16, 2014 · 2 comments
Closed

section $valid? #98

jakecoffman opened this issue Sep 16, 2014 · 2 comments

Comments

@jakecoffman
Copy link

I can tell if a form is valid by checking $valid, but is there a way to tell if a section is valid or not? E.g. if I have 3 sections I want to display that section 2 is invalid but the others are valid.

@davidlgj
Copy link
Contributor

This is a function for the form and ng-form directive in angular, so a section doesn't have that.
What you could do is since angular handles nesting of forms you can have an over arching form element and nest a couple of ng-form directives inside, each with an sf-schema that has a form definition that just selects the part of the form you like.

Something like (warning untested code ahead)

<form>
  <h1>part one</h1>
  <div ng-form sf-schema="schema" sf-form="part1" sf-model="model">

  <h1>part two</h1>
  <div ng-form sf-schema="schema" sf-form="part3" sf-model="model">

  <h1>part three</h1>
  <div ng-form sf-schema="schema" sf-form="part3" sf-model="model">
</div>
</form>

@jakecoffman
Copy link
Author

That's a clever solution, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants