Make button type nullable.

Fixes #GH365
This commit is contained in:
mark_story 2012-02-13 21:00:57 -05:00
parent d46127e3ad
commit afecb713ab
3 changed files with 5 additions and 2 deletions

View file

@ -5897,6 +5897,9 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->button('<Clear Form>', array('type' => 'reset', 'escape' => true));
$this->assertTags($result, array('button' => array('type' => 'reset'), '&lt;Clear Form&gt;', '/button'));
$result = $this->Form->button('No type', array('type' => false));
$this->assertTags($result, array('button' => array(), 'No type', '/button'));
$result = $this->Form->button('Upload Text', array('onClick' => "$('#postAddForm').ajaxSubmit({target: '#postTextUpload', url: '/posts/text'});return false;'", 'escape' => false));
$this->assertNotRegExp('/\&039/', $result);
}

View file

@ -1548,7 +1548,7 @@ class FormHelper extends AppHelper {
$name = str_replace(array('[', ']'), array('.', ''), $options['name']);
$this->_secure($options['secure'], $name);
}
return $this->Html->useTag('button', $options['type'], array_diff_key($options, array('type' => '')), $title);
return $this->Html->useTag('button', $options, $title);
}
/**

View file

@ -69,7 +69,7 @@ class HtmlHelper extends AppHelper {
'file_no_model' => '<input type="file" name="%s" %s/>',
'submit' => '<input %s/>',
'submitimage' => '<input type="image" src="%s" %s/>',
'button' => '<button type="%s"%s>%s</button>',
'button' => '<button%s>%s</button>',
'image' => '<img src="%s" %s/>',
'tableheader' => '<th%s>%s</th>',
'tableheaderrow' => '<tr%s>%s</tr>',