jonjamz / blaze-forms

Dead easy reactive forms with validation (Meteor).
https://atmospherejs.com/templates/forms
MIT License
113 stars 11 forks source link

Fix to allow validation of array fields as reactive elements #80

Closed davidecantini closed 8 years ago

davidecantini commented 9 years ago

Hi, Let's say we have a simple schema like this:

new SimpleSchema({
  emails: {
    type: [String],
    label: "Your Emails",
    regEx: SimpleSchema.RegEx.Email,
    minCount: 1,
    min: 5
  }
})

and the requirements would be:

Can you please provide some indications/best practices on how that could be achieved? This may be about adding examples to the docs but possibly adding some features or bug fixing.

Thanks in advance for your attention.

davidecantini commented 9 years ago

Update: For the points mentioned above, I was eventually able to add support to meet the requirements and get an approach like the user's application linked in the package docs to work properly. However, that required some extra code at app level that could be completely avoided if the package could have a feature (or fix) like the one described in issue 73:

"There may be some issue with it collecting data from individual elements and not handling when they are removed. Perhaps something needs to be added to handle this in an onDestroyed hook in the form elements."

@jonjamz Hopefully that, or any equivalent feature that you think can achieve the same goal (i.e. make sure that only the values of elements that have a .reactive-element class at the time of submit action are included in the valid values) can be introduced in the next versions.

With that in place, I think the package is great and would definitely star it.

Thanks in advance.

davidecantini commented 8 years ago

@jonjamz Once you release version 2.0 with the modifications mentioned in issue 84 you can close this issue, which will get addressed by the new release. Thank you.

jonjamz commented 8 years ago

Thanks!