Open jonjamz opened 8 years ago
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;
},
Thanks, fixed that one.
Oops forgot to mention: TemplatesForms.registerFormElement
should be ReactiveForms.createElement
. ...Unless you're changing the method names in the next version.
Yes I think in the next update I will change the namespace and method names, but I will keep aliases for backwards compatibility.
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.
}
});
Fixed that one too, thanks.
Continued from #14.