Tuesday, March 27, 2012

Is it possible to implement a "no answer" null value on a boolean field?

Is it possible to implement a "no answer" null value on a boolean
field? For example this is what I have in the view but it does not
work:
$options = array(true => 'yes', false => 'no', null => 'no answer');
echo $this->Form->input('music', array('options' => $options, 'empty'
=> null));

Answering 'no' saves ok to the database, but it shows '(no answer)'
when editing the record. And giving 'no answer' does not save a null
to the database. What's the correct way to do this?

Thanks.

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