Tuesday, February 28, 2012

Re: Map checkboxes to bitmask

that's exactly how the checkboxes get translated ;)
on beforeValidate() - or manually


On 28 Feb., 13:40, Boyan Penev <boyan.m.pe...@googlemail.com> wrote:
> That was really helpful, and i will try to use it, thanks.
>
> But my problem is slightly different (I wasn't specific enough the first
> time):
>
> i want to evaluate the whole result from the checkboxes. For example:
>
> None of the checkboxes checked = 0
> First-checked, second-not = 1
> First-not checked second-checked = 2
> Both checked = 3
>
> Regards,
>
> Boyan
>
> On Sun, Feb 26, 2012 at 7:59 PM, euromark <dereurom...@googlemail.com>wrote:
>
>
>
>
>
>
>
> > seems like exactly the thing I did the last couple of days:
> >http://www.dereuromark.de/2012/02/26/bitmasked-using-bitmasks-in-cake...
> > although I used real bitmasks (integer)^^
>
> > for the view you should then use a "multiple checkbox" form field
>
> > On 26 Feb., 13:29, Boyan Penev <boyan.m.pe...@googlemail.com> wrote:
> > > 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 sitehttp://ask.cakephp.organd 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
> > athttp://groups.google.com/group/cake-php

--
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: