Mohitsahu123 / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
GNU General Public License v3.0
0 stars 0 forks source link

name is a valid attribute on a form tag #125

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use this example:
 $form= new form("myForm");
 $form->setAttributes(array(
    "width" => 500,
    "map" => array(2, 2, 2, 1),
    "name" => "myForm",
 ));
 $form->addTextbox("myLabel:", "myField", "Can't touch this");
 $form->addButton();
 $form->render();

2. Add JS code to reference the DOM by document.myForm 
(In my case, I added the code to disable a TextField)
<script type="text/javascript">
document.myForm.myField.disabled = true;
</script>

3. Note error in JS. No field.

What is the expected output? What do you see instead?

Expected output is to have the field disabled.
Field is still editable because "name" is not defined.

What version of the product are you using? On what operating system?

latest patch release. (1.1.4-Patch) LAMP stack.

Please provide any additional information below.

"name" is a valid attribute, and is actually needed to reference a form in the 
DOM by name. Adding the "name" attribute doesn't generate the appropriate HTML 
when the form is rendered.

Add "name" to the allowedFields list for form.

        $this->allowedFields = array(
            "form" => array("action", "name", etc...

Original issue reported on code.google.com by sy...@coronastreet.net on 18 Apr 2011 at 6:26

GoogleCodeExporter commented 8 years ago
Thanks for reporting this bug.  As mentioned above, "name" needs to be added to 
the form's accepted fields array on line 187.

Alternatively, you can reference a form by 
id...document.getElementById("myForm")

- Andrew

Original comment by ajporterfield@gmail.com on 18 Apr 2011 at 1:45

GoogleCodeExporter commented 8 years ago
This was fixed with the 1.1.4 Patch version release.

Original comment by ajporterfield@gmail.com on 14 May 2011 at 3:19