<?php
$checked = (array_key_exists(checkboxName, $this->data[Model]) &&
!empty($this->data[Model][checkboxName])) ? 'checked' : '';
?>
<input type="checkbox" checked="<?php echo $checked;?>"
That what you mean?
Alternatively have a bit of a closer looker at the FormHelper::input method,
there is quite a bit of flexibility over the html output if that suits your
needs better.
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of kai
Sent: Tuesday, January 13, 2009 6:06 AM
To: CakePHP
Subject: returning checkmarked checkboxes after form is submitted
I'm manually building my checkbox inputs so i can display them in a
special way. how can i have the marked checkboxes remain marked after
the form is submitted? This comes as a core feature when using $form-
>input() but i'm having trouble figuring out how to get this working
manually. (other than this checkmark problem it's all working good and
follows the same html as $form->input() and returns a correctly
formatted $this->data array).
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.176 / Virus Database: 270.10.6/1888 - Release Date: 1/12/2009
7:04 AM
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---