blaze-forms icon indicating copy to clipboard operation
blaze-forms copied to clipboard

Finalize v2 docs

Open jonjamz opened this issue 9 years ago • 6 comments

Continued from #14.

  • [ ] Align API method names in v2 docs with current method names.
  • [ ] Find and fix broken example components.

jonjamz avatar Feb 25 '16 18:02 jonjamz

Hey @jonjamz, The validationValue needs amending in AdjustableNumberOfInputs

This outputs correctly for me...

validationValue: function (el, clean, template) {
   var values = $.map($(el).find("input"), function(e,i) {
      return $(e).val();
   });
  return values;
},

7ammer avatar Feb 25 '16 18:02 7ammer

Thanks, fixed that one.

jonjamz avatar Feb 25 '16 19:02 jonjamz

Oops forgot to mention: TemplatesForms.registerFormElement should be ReactiveForms.createElement. ...Unless you're changing the method names in the next version.

7ammer avatar Feb 25 '16 19:02 7ammer

Yes I think in the next update I will change the namespace and method names, but I will keep aliases for backwards compatibility.

jonjamz avatar Feb 25 '16 20:02 jonjamz

The validationValue for DateAndTime needs amending.

The below worked for me:

<template name="dateTimeElement">
    <div class="reactive-element">
        Date: <input type="date" value={{dateToString value}}><br>
        Time: <input type="time" value={{timeToString value}}>
    </div>
    {{#if submitted}}
        {{#if errorMessage}}<p class="error-message">{{errorMessage}}</p>{{/if}}
    {{/if}}
</template>
Template.dateTimeElement.helpers({
    dateToString: function(val){
        return new Date(val).toDateString();
    },
    timeToString: function(val){
        return new Date(val).toTimeString();
    }
});

ReactiveForms.createElement({
  template: 'dateTimeElement',
  validationEvent: 'change',
  validationValue: function (el, clean, template) {
      var values = $.map($(el).find("input"), function(e,i) {
          return $(e).val();
      });
      return new Date(values.join('T')); // A single Date Object.
  }
});

7ammer avatar Feb 25 '16 22:02 7ammer

Fixed that one too, thanks.

jonjamz avatar Feb 26 '16 16:02 jonjamz