SO i have a checkbox in my template which is (jade)
input(type='checkbox' name='flag' class='pure-checkbox onoffswitch-checkbox' id='myonoffswitch')
and i use this custom template form my flag field
schema: flag: template: require ('templates/onoff-switch.hbs') threshold: type: 'Text' title: 'Threshold($)' editorClass: 'pure-input-1-3'
but when i submit my form the flag value is not set, its empty. I hope i have to bind my value to the checkbox value but i am sure how.
i tried
input(type='checkbox' name='flag' class='pure-checkbox onoffswitch-checkbox' id='myonoffswitch' checked="{{#if flag}}checked{{/if}}")
Can someone help?
Create a custom form editor called 'switch' extending Backbone.Form.editors.Checkbox and use your own template in it. Something like
Refer Backbone Forms https://github.com/powmedia/backbone-forms for more information on Custom editor and how to extend Checkbox.