Add a name parameter to a couple of the form elements

This commit is contained in:
Evan Prodromou 2009-01-14 01:04:09 -05:00
parent ab158502b0
commit e1907c9cb5
1 changed files with 6 additions and 6 deletions

View File

@ -258,15 +258,14 @@ class HTMLOutputter extends XMLOutputter
* *
* @param string $id element ID, must be unique on page * @param string $id element ID, must be unique on page
* @param string $value hidden element value, default null * @param string $value hidden element value, default null
* @param string $name name, if different than ID
* *
* @return void * @return void
*
* @todo add a $name parameter
*/ */
function hidden($id, $value) function hidden($id, $value, $name=null)
{ {
$this->element('input', array('name' => $id, $this->element('input', array('name' => ($name) ? $name : $id,
'type' => 'hidden', 'type' => 'hidden',
'id' => $id, 'id' => $id,
'value' => $value)); 'value' => $value));
@ -305,18 +304,19 @@ class HTMLOutputter extends XMLOutputter
* @param string $id element ID, must be unique on page * @param string $id element ID, must be unique on page
* @param string $label text of the button * @param string $label text of the button
* @param string $cls class of the button, default 'submit' * @param string $cls class of the button, default 'submit'
* @param string $name name, if different than ID
* *
* @return void * @return void
* *
* @todo add a $name parameter * @todo add a $name parameter
*/ */
function submit($id, $label, $cls='submit') function submit($id, $label, $cls='submit', $name=null)
{ {
$this->elementStart('p'); $this->elementStart('p');
$this->element('input', array('type' => 'submit', $this->element('input', array('type' => 'submit',
'id' => $id, 'id' => $id,
'name' => $id, 'name' => ($name) ? $name : $id,
'class' => $cls, 'class' => $cls,
'value' => $label)); 'value' => $label));
$this->elementEnd('p'); $this->elementEnd('p');