So, you want to pre-populate the selectBox with the existing Model
value? This depends on how you are getting your User data from your
controller. If you have
$user = $this->User->read( null, $user_id );
$this->set( 'user', $user );
Then in your view you want:
<?php echo $html->selectTag('User/locked', array('y'=>'Yes',
'n'=>'No'), $user['User']['locked'], null, null, false); ?>
However, I personally think it is better to let Cake automatically
prepopulate, and it does this from the $this->data array. So, in your
controller have:
$user = $this->User->read( null, $user_id );
$this->data = $user;
And in your view just have:
<?php echo $html->selectTag('User/locked', array('y'=>'Yes',
'n'=>'No'), null, null, null, false); ?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---