It's sad to say, but i think that wthis Form Framework is Overengineering,
Overcomplicated, Less documented and don't take care of this basic
behaviour, this problem is an example.

It's possible to have a complete Form Framework like this and discuss on "*"
to put on required fields ? I don't think, we have some big problems, for
Symfony 1.3 i hope for a big human refactoring of Form Framework :(

On Thu, Feb 26, 2009 at 11:42 AM, Tomasz Ignatiuk
<tomek.ignat...@gmail.com>wrote:

>
> It is not good solution because using css pre doesn't work in
> IE...which is used by....I don't know...50% of users?
>
> On 26 Lut, 06:58, avorobiev <vorobiev.alexan...@gmail.com> wrote:
> > Look athttp://
> groups.google.com/group/symfony-devs/browse_thread/thread/4c81...
> >
> > On Feb 24, 2:20 pm, Tomasz Ignatiuk <tomek.ignat...@gmail.com> wrote:
> >
> > > On 16 Sty, 13:35, Thomas Dedericks <tho...@tequila-studio.com> wrote:
> >
> > > > Hi,
> >
> > > > Not tested:
> >
> > > > public function configure() {
> >
> > > >         ...
> >
> > > >         # add * torequiredfields' labels:
> > > >         foreach ($this->widgetSchema as $name => $widget)
> > > >         {
> > > >                 if (isset($this->validatorSchema[$name]) &&
> $this->validatorSchema[$name]->hasOption('required') &&
> $this->validatorSchema[$name]->getOption('required') == true)
> > > >                 {
> > > >                         $label = ($widget->getLabel() != null) ?
> $widget->getLabel() : $name;
> > > >                         $widget->setLabel($label.' *');
> > > >                 }
> > > >         }
> >
> > > > }
> >
> > > > Thomas Dedericks
> >
> > > Unfortunatelly it doesn't work. But if you do some stuff before and
> > > with little change...it works :)
> > > 1. Required option is true as default. I don't know why it isn't set
> > > in widgetSchema. So this won't work:
> $this->validatorSchema[$name]->hasOption('required') &&
> $this->validatorSchema[$name]->getOption
> >
> > > ('required') == true
> > > 2. If label is set in generator.yml, it isn't  set in widgetSchema, so
> > > $widget->getLabel() != null is always null You have to set it manually
> > > in configure()
> > > 3. widgetSchema i a set of objects, not name fields, so you have to
> > > add this:   foreach ($this->widgetSchema->getFields() as $name =>
> > > $widget)
> >
> > > So you have to set labels for requried fields in configure() of a form
> > > and for some fields, like boolean you have to add manually required to
> > > true, like this: $this->validatorSchema['master'] = new
> > > sfValidatorBoolean(array('required' => true)); And also change this:
> > > && $this->validatorSchema[$name]->getOption('required') != false).....
> > > required != false
> >
> > >     foreach ($this->widgetSchema->getFields() as $name => $widget)
> > >     {
> > >       if (isset($this->validatorSchema[$name]) &&
> $this->validatorSchema[$name]->hasOption('required') && $this-
> > > >validatorSchema[$name]->getOption('required') != false)
> >
> > >       {
> > >         $label = ($widget->getLabel() != null) ? $widget->getLabel() :
> > > $name;
> > >         $widget->setLabel($label.' *');
> > >       }
> > >     }
> >
> > > All in all it is faster just to add * manually for required fields:
> > >     $this->widgetSchema->setLabels(array(
> > >         'logo' => 'Logo *',
> > >         'name' => 'Name *',
> > >         'master' => 'Master *',
> > >     ));
> >
>


-- 
Paolo Mainardi

Vice Presidente Assoc.ILDN (http://www.ildn.net)
Blog: http://www.paolomainardi.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to