PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #925

form name attribute does not exist in xhtml1.1

Details

Submitted2004-02-28 20:44 UTC
Frominside at parasiterecords dot com
Assignedavb
StatusClosed
PackageHTML_QuickForm
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2004-02-28 20:44 UTC] inside at parasiterecords dot com

Description:
------------
This is what I get when validating my xhtml1.1 document :

<form action="/test2.php" method="post" name="myForm" id="myForm">
Error: there is no attribute name for this element (in this HTML version)

The form attributes are generated in the HTML/QuickForm.php file like this :

$attributes = array('action'=>$action, 'method'=>$method, 'name'=>$formName, 'id'=>$formName) + $target;

Reproduce code:
---------------
require_once "HTML/QuickForm.php";
$form = new HTML_QuickForm('myForm');

$form->addElement('text', 'name', 'Nom : ');
$form->addElement('submit', 'btnSubmit', 'Submit');

if ($form->validate()) {
$form->freeze();
}
$form->display();

Expected result:
----------------
<form action="/test2.php" method="post" id="myForm">

Actual result:
--------------
<form action="/test2.php" method="post" name="myForm" id="myForm">

[2004-02-29 10:18 UTC] mansion at php dot net

We could also add a name property to the form object, instead of the attribute and use getName() instead of getAttribute('name'). If the developer wants a name attribute in his <form> tag, he should be free to do so using updateAttributes(), as he might be using some old javascript code relying on this.

I think this way we don't need to change accept(). But we will have to find every places where getAttribute('name') is called.