Sorry I've not understand what the problem is. The select doesn't
prepopulate well?
Try checking what the value of
debug( $this->request->data('Patient.bloodgroup') );
If it is a text value you need to give the right key to the select
$_bloodgroup = array_flip( $bloodgroup );
echo $this->Form->input('bloodgroup', array(
'type' => 'select',
'label' => 'blood group',
'options' => $bloodgroup,
'default' => '1',
'value' => $_bloodgroup[$this->request->data('Patient.bloodgroup')]
));
Il 05/04/2012 08:07, alexkd ha scritto:
As per your suggestion I added in afterFind(). Its working in
add,index and view.
But in edit, the select box is showing wrong because of the adjustment
in afterfind.
//
$bloodgroup = array(
'0' => 'RH A+',
'1' => 'RH A-',
'2' => 'RH B+',
'3' => 'RH B-',
'4' => 'RH AB+',
'5' => 'RH AB-'
);
echo $this->Form->input('bloodgroup', array('type' => 'select',
'label' => 'blood group', 'options' => $bloodgroup, 'default' =>
'1'));
//
How can I add an empty field with the find query so I can duplicate
bloodgroup. and use it in edit.ctp
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php