Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.2.6
-
None
-
None
-
Windows XP Professional, Firefox 3.0.11, MyFaces 1.2.6 Tomahawk-12 1.1.8 (and RichFaces 3.3.1 GA), Tomcat 6.
Description
In
function oamSetHiddenInput(formname, name, value)
the test
if(typeof form.elements[name]!='undefined' && form.elements[name].nodeName=='INPUT')
does not cover <input> elements where nodeName is 'input' (that is: lower case characters instead of upper case 'INPUT').
This results in the following error:
If the form already contains an input element with the specified name, but nodeName=='input', the test fails and a new input element with the same name is added to the form.
If the form is submitted, the HTTP request will contain 2 values for the parameter referenced by 'name':
one is the value of the unchanged <INPUT> field, the other is the value of the newly created <input> field.
Most UIComponents do not check if there is more than one value for a parameter.
Probably they will just interpret the first value - which might be the 'wrong' value of the <INPUT> field instead of the 'valid' value of the <input> field.
How I achieved this situation:
Even though MyFaces typically renders input fields with lower case characters (XHTML), when a page is rendered by Firefox, the nodeName of input elements seems to be the upper case variant. I wonder why.
Now, we use RichFaces' a4j:poll in order to perform periodical partial page updates.
The updated part of the page may contain locically equivalent input fields, but in lower case.
The JavaScript behind a4j:poll uses the W3C DOM method replaceChild() in order to update page fragments.
This method replaces the original <INPUT> fields by <input> fields.
Of course, it doesn't matter how <input> elements become part of a page.
In oamSetHiddenInput() <input> should be treated like <INPUT>.