I want to store a time value in seconds in the DB.
In the form, the user should be able to type it as a String (MM:SS). After submission the String (MM:SS) should be transformed into seconds. That is why the schema the form is validated against differs from the schema used to validate against in the backend (right before writing it to the database).
So I did what is supposed here (https://github.com/aldeed/meteor-autoform#autoform-1) and I defined two schemas, one for the form (with time.type = "String") and another one that I attached to the collection (time.type = Number).
In the template I set both parameters, collection="TimeItem"
and schema="SpecialFormSchema
.
In the end, the form always renders with a HTML Number input field and ignores the form schema.
Can anybody help? Thanks in advance!
It actually works as it should. My silly mistake was to experiment with different templates and worked on the wrong one and therefore did not see any results.
The working javascript:
What the template looks like: