Hi Martin!

> You could write a object_select_rating_tag helper like that instead:
[...]

Without having tested your approach, I think have tried something similiar 
and it didn´t work. But I´ll give it another trial.   

Thanks anyway

Timo


On 7 May 2007 at 18:43, Martin Kreidenweis wrote:

> 
> Hi.
> 
> > - I would be nice to have more custom type form fields in the backend.
> > For Example, if I have a Int field in a Model DB-Table and I want it to 
> > carry
> > just digits from 1 - 6 (a Rating), I cannot render it to a select field 
> > without 
> > making a new (Model) class for just this one Table-field. A bit to much 
> > overhead for not even a byte of information IMHO.
> 
> You could write a object_select_rating_tag helper like that instead:
> 
> function select_rating_tag($name, $selected, $options) {
>   return select_tag($name, options_for_select(range(1, 6), $selected));
> }
> 
> function object_select_rating_tag($object, $method, $options = array(),
>     $default_value = null)
> {
>   $options = _parse_attributes($options);
> 
>   $value = _get_object_value($object, $method, $default_value);
> 
>   return select_rating_tag(_convert_method_to_name($method, $options),
>                            $value, $options);
> }
> 
> Then just set the edit control type in your generator.yml to
> select_rating_tag for the respective field.
> 
> Or if you have no need to reuse the code simply put it in a partial.
> 
>  Martin
> 
> > 


************************************** 
Timo Michna
************************************** 
matikom
Michna & Wilhelm GbR
Schlegelstr. 23
10115 Berlin
Tel.: ++49 (0)30 / 28 09 36 70
Fax: ++49 (0)30 / 28 09 36 71
E-Mail: [EMAIL PROTECTED]
Web: www.matikom.de
**************************************   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" 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-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to