Home » HTML » HTML_QuickForm » Bug #925
form name attribute does not exist in xhtml1.1
Details
| Submitted | 2004-02-28 20:44 UTC |
|---|---|
| From | inside at parasiterecords dot com |
| Assigned | avb |
| Status | Closed |
| Package | HTML_QuickForm |
| PHP Version | Irrelevant |
| OS | Irrelevant |
| 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.