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

--~--~---------~--~----~------------~-------~--~----~
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