/** * Returns a radio button tag. * * The radio button will be checked if the current value of <var>$method</var> is * equal to <var>$tagValue</var>. * Example : * <code>radio_button('post', 'title', $this->post, 'Hello World'); * <input id="post_title_hello_world" name="post[title]" type="radio" value="Hello World" /></code> */ function radio_button($objectName, $method, $object, $tagValue, $options = array()) { list($name, $value, $options) = default_options($objectName, $method, $object, $options); $options['id'] .= '_' . SInflection::wikify($tagValue); if ($value == $tagValue) { $checked = True; } else { $checked = False; } return radio_button_tag($name, $tagValue, $checked, $options); }
<body> <h1>EasyRdf Graph Dumper</h1> <div style="margin: 10px"> <?php echo form_tag(); ?> URI: <?php echo text_field_tag('uri', 'http://metade.org/foaf.rdf', array('size' => 80)); ?> <br /> Format: <?php echo label_tag('format_html', 'HTML') . ' ' . radio_button_tag('format', 'html', true); ?> <?php echo label_tag('format_text', 'Text') . ' ' . radio_button_tag('format', 'text'); ?> <br /> <?php echo submit_tag(); ?> <?php echo form_end_tag(); ?> </div> <?php if (isset($_REQUEST['uri'])) { $graph = new EasyRdf_Graph($_REQUEST['uri']); if ($graph) {
public function testRadioButtonTag() { $this->assertDomEqual(radio_button_tag('people', 'raph'), '<input id="people" name="people" type="radio" value="raph" />'); }