Skip to content
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

Nested Forms and Repeating Fields #2

Open
enyachoke opened this issue Sep 17, 2016 · 5 comments
Open

Nested Forms and Repeating Fields #2

enyachoke opened this issue Sep 17, 2016 · 5 comments

Comments

@enyachoke
Copy link

Do you plan on supporting question nesting and repeating questions.

@flauc
Copy link
Owner

flauc commented Sep 17, 2016

Hi @enyachoke, I'm planing on extending the repository quit a lot, but I'm not really sure what you mean by nesting questions.

Can you give me an example?

@enyachoke
Copy link
Author

There are times you may have a model like this

questions: [{
    type: "group",
    key:"nested",
    questions: [{
      type: 'text',
      key: 'firstName',
      value: 'John Doe',
      label: 'First Name',
      validation: [{
        type: 'required'
      }, {
        type: 'minLength',
        value: 5,
        message: 'Please enter a name longer then 5 characters'
      }, {
        type: 'pattern',
        value: '^[a-zA-Z ]+$',
        message: 'Only letters and spaces are allowed'
      }]
    }]
  },

  {
    type: 'text',
    key: 'firstName',
    value: 'John Doe',
    label: 'First Name',
    validation: [{
      type: 'required'
    }, {
      type: 'minLength',
      value: 5,
      message: 'Please enter a name longer then 5 characters'
    }, {
      type: 'pattern',
      value: '^[a-zA-Z ]+$',
      message: 'Only letters and spaces are allowed'
    }]
  }
]

@enyachoke
Copy link
Author

enyachoke commented Sep 17, 2016

Something on like a form with an address http://blog.thoughtram.io/angular/2016/06/22/model-driven-forms-in-angular-2.html

@flauc
Copy link
Owner

flauc commented Sep 17, 2016

To be honest i haven't been following the progress of forms in angular 2 lately. I see what you're getting at, and I'm definitely going to implement grouping at some point, but I'm not sure when i'll have the time.

If you're interested please feel free to send a PM of any kind, even a small commits help a lot 👍

@enyachoke
Copy link
Author

I have a custom schema and I made a very poor attempt at something like this https://github.com/enyachoke/angular2-formentry (a prototype really). What I like about your code is it is well organized and solves a validations headache I have been having. Am basing off your code and adding the features my use case needs that is groups and repeating groups. If I crack it I will send a pr for sure. Thanks.

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

No branches or pull requests

2 participants