in my edit function, i need to reselect for the field again to save it. how can i added a 'selected'=>$addresscountry field in my $form->select function??
this is my code..
echo $country->select('Address.txtother_country','Please Choose Your Country'
which $country is 1 of the helper that include by the page, let user to select country. i need it automatic to refer back 开发者_StackOverflow社区to the previous data which had save, means add a selected value in my edit function.
any 1 can help? thanks..
It'd be useful to see the code for the country helper you've downloaded. There's one called CountryList at http://bakery.cakephp.org/articles/view/country-select-list-helper which seems to do what you want - it may be worthwhile dropping that in.
Cheers JB
i had found out ther answer, which this link i calling the country helper to view for the country lists.
in the helper header,you will see that is
function select($fieldname, $label, $default=" ", $attributes=array())
just change it's default to the
function select($fieldname, $label, $default, $attributes=array())
and at edit page, just follow the field to put in the element, which is like
echo $country->select('Address.txtother_country','Please Choose Your Country', $addresscountry)
$addresscountry need to find out the data in ur controller and just put at there. if any 1 facing the same problem can have a try, which is using a select country helper, and you wan set the default answer in ur edit page.
精彩评论