Hello,
Your default value is "English", so the widget #2 is OK the first one must inherits from your object value. Does your object method "getLanguage" returns "Romanian" by default ? Try debugging : $myObject = new Product(); echo $myObject->getLanguage(); Do you bind values to form ? Are you using admin generator ? 2009/11/29 pghoratiu <[email protected]> > Hello! > > I have encountered a strange behavior with one of my forms and I can > not explain what may be causing it. > I have the same widget defined twice (the same way) and the first one > is not working corectly the second one is ok (they are defined exactly > the same way): > > $this->widgetSchema['language'] = new sfWidgetFormChoice(array( > 'choices' => $this->getLanguages(), > 'multiple' => false, > 'expanded' => false, > 'default' => 'English' > )); > > $this->widgetSchema['language2'] = new sfWidgetFormChoice(array( > 'choices' => $this->getLanguages(), > 'multiple' => false, > 'expanded' => false, > 'default' => 'English' > )); > > The language is actually a table column in a Product table, language2 > is not a column in the db (not sure if this is important). Given that > the widget generated code is the same the output should be the same > but it's not, I can not set up the default value in the first case, > the second case works as expected: > > <label for="product_language">Language</label> > <div class="content"> > <select name="product[language]" id="product_language"> > <option value="Romanian" selected="selected">Romanian</option> > <option value="English">English</option> > </select> > </div> > > <label for="product_language2">Language2</label> > <div class="content"> > <select name="product[language2]" id="product_language2"> > <option value="Romanian">Romanian</option> > <option value="English" selected="selected">English</option> > </select> > </div> > > I don't know what is causing this behavior, I suspect that the column > name "language" is the problem. > > Any ideas? > > My environment is Symfony 1.2.9 with Doctrine, php 5.2.9. > > gabriel > > -- > > 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]<symfony-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en. > > > -- Alexandre Salomé -- [email protected] -- 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.
