You need to sign in to do that
Don't have an account?
Chris Mair
Binding CSS Toggle to Checkbox field. Help!?
So I have this code in Visualforce and it renders great, but when I submit the record the value isn't stored in the Checkbox field. Can anyone let me know what I'm doing wrong? I could just use a standard checkbox but I really like the look of the CSS Styled Toggle.
Thanks!
<div class="onoffswitch">
<input value="{!Registration_Request__c.Reading_A_Z__c}" type="checkbox" name="onoffswitch1" class="onoffswitch-checkbox" id="myonoffswitch1">
<label class="onoffswitch-label" for="myonoffswitch1">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</input>
</div>
Thanks!
<div class="onoffswitch">
<input value="{!Registration_Request__c.Reading_A_Z__c}" type="checkbox" name="onoffswitch1" class="onoffswitch-checkbox" id="myonoffswitch1">
<label class="onoffswitch-label" for="myonoffswitch1">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</input>
</div>
SFDC bind value to controller if you use apex:inputcheckbox. you can define the styleClass attirbute to put your custom css.
if you still want to use above code then you can bind value to a apex:inputHidden and set value using javascript so that controller read that value while saving.
Makes sense ?
Thanks,
Himanshu