Friday, May 8, 2009

Object form helper for radiobutton

First make a helper named as radioHelper and inside the file put the function for object_radiobutton_tag. and can use it on templates.please check code below
Quote:


use_helper('Form');
function object_radiobutton_tag($object, $method, $value, $options = array())
{
$options = _parse_attributes($options);

// See if the object contains the value passed in
// if yes, set "true" (radio button toggled on)
if ( _get_object_value($object, $method) == $value )
{
$checked = true;
}
else
{
$checked = false;
}

return radiobutton_tag(_convert_method_to_name($method, $options), $value, $checked, $options);
}

------------------

1 comments:

  1. Howto use this helper for radiobutton? edit /usr/share/pear/symfony/helper/ObjectHelper.php?

    Than You

    ReplyDelete