Lee: Sounds like a great idea, but it still requires manual labor each
time a new Form is generated (I generate mine via Propel). If there
were a way to automate this, it would be the way to go!

Thomas: Thanks. This is a great start. I was looking for something
more along the lines of making a custom decorator to do this without
us having to put this piece of code in each form (I have a lot!). Then
again, I suppose your code could be put into a static function and
invoked as a one-liner from the forms.

I'll take a stab at modifying the decorator and report back.

On Jan 16, 5:35 pm, 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.' *');
>                 }
>         }
>
> }
>
> Le jeudi 15 janvier 2009 à 22:58 -0800, CiPheR a écrit :> Does anyone know 
> how to automatically add anindicator(like "*" or
> > "required") to the labels of propel generated forms? Considering that
> > the form validator already knows which fields arerequired, it would
> > be nice if we can show the user which fields arerequiredright away
> > rather than have them submit and the come back with "required"
> > validation messages.
>
> --
>
> Thomas Dedericks
>
> tho...@tequila-studio.com
> GSM: +32 (0) 499 23 60 22http://tequila-studio.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