I wrote a view that generates a form. One of the fields is defined in
the database as tinyint(1) (aka bool). FormHelper-input()
correctly renders a checkbox for this field, but does not set it to
checked, even when the value is 1.
?= $this-Form-input($field, array(
Slight correction. The hardcoded attempt _does_ work. There was a
logic error so a different branch was getting executing.
$this-Form-checkbox('Equipment.collect', array(
'checked' = true, //
$equip['collect'],
))
http://www.dereuromark.de/2010/06/23/working-with-forms/
default values
On 27 Apr., 19:23, lsiden lsi...@gmail.com wrote:
Slight correction. The hardcoded attempt _does_ work. There was a
logic error so a different branch was getting executing.
$this-Form-checkbox('Equipment.collect',
Hi all!
Firstly - I am completely newbie in Cake.
My problem is - in edit mode in my admin side I need to set checkbox
for is_track field [TINYINT(1)] checked and have no idea how to do it.
The way I am trying to do it:
VIEW:
?=$html-checkbox('Download/is_track', null, array('value' =1,
[EMAIL PROTECTED] wrote:
http://api.cakephp.org/html_8php-source.html#l00259
Looking at the API and the corresponding code. Looks like that if you
pass 'value' = 'checked' that would do it.
Thank you for reply.
But 'value' = 'checked' also does not work.
I looked through API :
00260
you need to specify a checkbox value
?php echo $html-checkbox('Download/is_track',null,array
('value'='1'))?
Then in your controller you just set
$this-data['Download']['is_track'] in the controller
--~--~-~--~~~---~--~~
You received this message because you
gwoo wrote:
you need to specify a checkbox value
?php echo $html-checkbox('Download/is_track',null,array
('value'='1'))?
Then in your controller you just set
$this-data['Download']['is_track'] in the controller
Thank you gwoo, but
?php echo
paste your controller and view in the cakebin.
http://cakephp.org/pastes/add
or jump on irc http://irc.cakephp.org
we can fix you up.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to
gwoo wrote:
paste your controller and view in the cakebin.
http://cakephp.org/pastes/add
or jump on irc http://irc.cakephp.org
we can fix you up.
Thank you, I will try.
it seems this is my own bug so far ...
--~--~-~--~~~---~--~~
You received this