$ form-> select fonksiyonu seçilen bir değeri ayarlamak nasıl?

2 Cevap php

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??

Bu benim kodudur ..

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 to the previous data which had save, means add a selected value in my edit function.

Herhangi 1 yardımcı olabilir? teşekkürler ..

2 Cevap

Bu indirdiğiniz ülke yardımcı için kodu görmek için yararlı olurdu. Ne istediğinizi yapmak gibi görünüyor http://bakery.cakephp.org/articles/view/country-select-list-helper de bir denir Country listesinden var - bu değerli düşüyor olması içeri olabilir

Cheers JB

ben bu linki ben ülke listeleri görüntülemek için ülke yardımcısı çağırarak orada cevap, dışarı bulmuştu.

yardımcı başlığında, böyle olduğunu göreceksiniz

function select($fieldname, $label, $default=" ", $attributes=array())

sadece varsayılan bulunuyor değiştirin

function select($fieldname, $label, $default, $attributes=array())

ve düzenleme sayfasında, tıpkı bir eleman koymak için alan izleyin

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.