The add_empty is automatically sets to true by the build-form task if your field is not required (have a look at your BaseKursForm class). So, set it to false in your KursForm class should remove the empty option.
On Tue, Jan 20, 2009 at 3:45 PM, Tomasz Ignatiuk <[email protected]> wrote: > Hmm...as I see this option is false as default, so why it adds empty field? > * add_empty: Whether to add a first empty value or not (false by default) If > the option is not a Boolean, the value will be used as the text value > > 2009/1/20 Tomasz <[email protected]> >> >> Hi, thank you for help :) >> I ment NOT to use blank page. So I have to add this: >> >> class KursForm extends BaseKursForm >> { >> public function configure() >> { >> $this->widgetSchema['waluty_logo']->setOption('add_empty', false) ; >> } >> } >> >> in lib\form\KursForm.class.php? >> Then symfony cc and it should delete blank option in select? >> waluty_logo is a foreign key of other table. >> Generated code looks like this: >> >> <select name="kurs[waluty_logo]" id="kurs_waluty_logo"> >> <option value="" selected="selected"></option> >> <option value="1">EUR</option> >> <option value="2">USD</option> >> <option value="3">PLN</option> >> </select> >> >> I want to delete the first option (<option value="" >> selected="selected"></option>) >> >> >> On 20 Sty, 15:06, "noel guilbert" <[email protected]> wrote: >> > Hi, >> > >> > since the new admin-gen, you must setup your fields in your form >> > class. So, if you want to add a blank option in your select box, you >> > must pass an 'add_empty' parameter to your widget: >> > >> > $this->widgetSchema[' waluty_logo']->setOption('add_empty', true) >> > >> > >> > >> > On Tue, Jan 20, 2009 at 2:38 PM, Tomasz <[email protected]> >> > wrote: >> > >> > > Hi guys >> > > I posted this question of >> > > forumhttp://www.symfony-project.org/forum/index.php/t/18286/ >> > > but no one could help me. Maybe you can. >> > >> > > The problem is that params: doesn't work anywhere For example: >> > >> > > config: >> > > edit: >> > > title: Edycja kursu "%%logo%%" z dnia "%%data%%" >> > > display: >> > > [waluty_logo,logo,kurs_sredni,kurs_kupna,kurs_sprzedazy,data] >> > > fields: >> > > waluty_logo: {params: include_blank=false} >> > >> > > This should make select not to inlcude blank field as first option. >> > > But it doesn't change anything. It seems symfony doesn't even pars it. >> > > When I change i to this >> > > fields: >> > > w a l u ty_logo: {pas: include_blank=false} >> > > It doesn't even show error >> > >> > -- >> > Noël >> > GUILBERThttp://www.noelguilbert.com/http://www.sensiolabs.comhttp://www.symfony-project.com >> > Sensio Labs >> > Tél: +33 1 40 99 80 80 >> > > > > > -- Noël GUILBERT http://www.noelguilbert.com/ http://www.sensiolabs.com http://www.symfony-project.com Sensio Labs Tél: +33 1 40 99 80 80 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" 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/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
