jonjamz / blaze-forms

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

Make `validationEvent` optional #33

Closed jonjamz closed 9 years ago

jonjamz commented 9 years ago

Assists with #31, particularly if the goal is to create a block helper to wrap elements:

<template name="elementContainer">
  <div class="elementContainer-container">
    <label>{{label}}</label>
    <br>

    {{> UI.contentBlock field=field}}

    {{#if submitted}}
      {{#if errorMessage}}<p class="error-message">{{errorMessage}}</p>{{/if}}
    {{/if}}
  </div>
</template>
steph643 commented 9 years ago

This does not seem to work for me in the following case:

<template name="bootstrapLabel">
    <label class="control-label">
        {{#if schema.label}}{{schema.label}}{{else}}{{field}}{{/if}}
    </label>
</template>

<template name="bootstrapInput">
    <div class="form-group  {{#unless valid}}has-error{{/unless}}">
        {{> bootstrapLabel}}
        <input name="{{field}}" class="form-control reactive-element" value="{{value}}">
    </div>
</template>

</template>
ReactiveForms.createElement(
    {
    template: 'bootstrapLabel',
    });
 Uncaught Error: Match error: Missing key 'validationEvent'
jonjamz commented 9 years ago

According to the schema it should be optional:

https://github.com/meteortemplates/forms/blob/master/lib/module.coffee#L593

Perhaps it's because of the extra , in your object?

steph643 commented 9 years ago

Sorry, my fault. I had this same issue again when updating your package: it said it was updated while in fact it was not. But I understood the reason now, no more false alerts.