You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Kevin Roast <ke...@alfresco.org> on 2005/06/24 17:35:16 UTC

FW: [jira] Created: (MYFACES-240) generated JavaScript clear_browse() function allows Internet Explorer to return "null" field values

Hi,

I was wondering if anyone else has seen this bug and can verify it? As
currently this would stop us moving our project from our own "patched"
version of Myfaces to the latest version :(

Thanks!

Kevin
--
http://www.alfresco.org


-----Original Message-----
From: Kevin Roast (JIRA) [mailto:myfaces-dev@incubator.apache.org] 
Sent: 11 May 2005 18:20
To: Kevin Roast
Subject: [jira] Created: (MYFACES-240) generated JavaScript
clear_browse() function allows Internet Explorer to return "null" field
values


generated JavaScript clear_browse() function allows Internet Explorer to
return "null" field values
------------------------------------------------------------------------
---------------------------

         Key: MYFACES-240
         URL: http://issues.apache.org/jira/browse/MYFACES-240
     Project: MyFaces
        Type: Bug
    Versions: 1.0.9 beta    
 Environment: WinXP SP1. Intel P4. JBoss 4.0.1sp1. JBoss Portal 2.0 RC.
MyFaces 1.0.9
    Reporter: Kevin Roast


Generated JavaScript "clear_browse()" function allows Internet Explorer
to return "null" string literal field values.

The clear_browse() function generated by MyFaces at the end of the FORM
tag to clear the various hidden fields output by the system sets the
field values to 'null' using JavaScript.

However, for applications that add their own hidden fields to the form
to be output in this way (as many advanced components do), it is
preferable to set the fields to the empty string "" instead. Otherwise
in Internet Explorer it will submit the literal string "null" as the
field value instead of the empty string. This can affect components that
decode() their values and are looking to see if a field has been set to
a value other than "". Of course the components could check for the
literal string "null" but that is a weak solution.

Modifying the following file:
   org/apache/myfaces/renderkit/html/HtmlRendererUtils.java
on line 700 changing:
writer.write("'].value=null;");
to
writer.write("'].value='';");
will fix the problem. 

This issue does not affect the FireFox browser which appears to be smart
enough to send up the empty string when JavaScript has set a hidden
field value to null.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira