Sunday, February 26, 2012

Map checkboxes to bitmask

Hello,

I would like to accomplish the following: out of 2 checkboxes, if only the first one is clicked, the value would be 10, if only the second one- 01, if both - 11. I tried giving the checkboxes the same name(array) attribute and different values, like:
$this->Form->input('example', array('type' => 'checkbox', 'name' => 'checked[]', 'value' => 1)
and i get an indexed array over which i need to iterate in the controller.
Does anyone have an idea, how could i map the values directly in the view, in order for the controller to receive the final result?

Thanks,

Boyan

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: