Variable name error in oamClearHiddenInput and oamSetHiddenInput: use formname 
instead of formName
--------------------------------------------------------------------------------------------------

                 Key: MYFACES-2433
                 URL: https://issues.apache.org/jira/browse/MYFACES-2433
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-252
    Affects Versions: 1.2.8
         Environment: MyFaces 1.2.8; Tomcat 6.0.18, Servlet 2.5, Java 1.6; 
Firefox 3.3.5
            Reporter: Lutz Ulruch


In MyFaces 1.2.8 in 
org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.prepareScript() 
2 errors slipped into the script functions oamClearHiddenInput and 
oamSetHiddenInput:

While trying to implement the workaround for document.forms[formname] not 
finding any form after partial page rendering and replacement of HTML  DOM 
fragments including HTML forms (because of a bug (?) in Firefox) a test has 
been added:

var form = document.forms[formname]; 
if ( typeof form == 'undefined')
{
    form = document.getElementById(formName);
}

But in oamClearHiddenInput and oamSetHiddenInput the function parameter is 
named 'formname' instead of 'formName' (only in oamSubmitForm is it named 
'formName'). 
That's why 

document.getElementById(formName)

does not work in both functions.

By the way: You probably fixed this due to the bug 2256 which I issued. 
Except for those two copy&paste erros it works and I want to thank you for the 
fix.
Maybe one should not use 

document.forms[formname]

and the test

if ( typeof form == 'undefined')

at all and just use 

var form = document.getElementById(formname) 

in order to keep the code simple.
But I do not know if you think this approach is to slow or maybe it does not 
work in all browsers.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to