[ 
https://issues.apache.org/jira/browse/MYFACES-2011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639642#action_12639642
 ] 

Leonardo Uribe commented on MYFACES-2011:
-----------------------------------------

Very strange issue (I spent a lot of time checking code to figure it out what's 
happening).

It does not happen with the following combinations:

myfaces 1.1.x and tomahawk 1.1.7
myfaces 1.2.4 and tomahawk12-1.1.7

but the combination myfaces 1.2.4 and tomahawk 1.1.7 causes the problem.

On myfaces 1.1.x when you use code like this:

    <h:commandLink value="Sample 1" action="go_sample1">
        <f:param name="param1" value="somevalue1"/>
    </h:commandLink>

The tag h:form adds the the param as a hidden field like this:

<input type="hidden" name="param1" />

In 1.1.x (inclusive tomahawk for 1.1 or tomahawk-1.1.7.jar), the input hidden 
fields are not added and removed from dom tree, instead the javascript function 
clearFormHiddenParams is used to clear the values.

In 1.2.x (inclusive tomahawk for 1.2 or tomahawk12-1.1.7.jar) the input hidden 
fields are added and removed from the tree. The reason to change it from 
previous behavior was enhance compatibility of myfaces core with trinidad 
(tr:form does not render hidden fields like h:form). This solution has other 
nasty problems with IE but everything was solved. The only exception of this 
rule is jscook_action hidden field (no special reason, and maybe changes in the 
future).

The solution is use tomahawk12 when you are using myfaces core 1.2.x. but maybe 
add some code on clearFormHiddenParams to check if the param exists or not does 
not harm. Something like this to check if the hidden field exists:

function clearFormHiddenParams_j_id_id20() {
  var f = document.forms['j_id_id20'];
  var elem0 = f.elements['param1'];
  if(typeof elem0 !='undefined' && elem0.nodeName=='INPUT'){
    if (elem0.value != '') {
      elem0.value='';
    }
  }

If no objections, I'll add this code to clearFormHiddenParams generation (on 
shared 3.0.x). 


> Javascript error on links after clicking a popup/download link
> --------------------------------------------------------------
>
>                 Key: MYFACES-2011
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2011
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 1.2.4
>         Environment: MyFaces 1.2.4 IE7
>            Reporter: Daniel Campagnoli
>             Fix For: 1.2.5-SNAPSHOT
>
>
> We have just upgraded from 1.1.6 to 1.2.4 and come across an issue that looks 
> similar to MYFACES-1804 in effect but looks to have a slightly different 
> cause.
> The issue occurs when you first click on a download/popup link and then go to 
> click another link on the same page.  
> This calls oamSubmitForm which at the end calls oamClearHiddenInput which 
> removes the hidden field from the dom.
> Now when you go and click on another link on the original page it calls 
> oamSubmitForm.  This first calls clearFormHiddenParams_formname which tries 
> to get the hidden field and set the value to empty, but because it has 
> already been removed from the dom the field null and an exception occurs.
> My workaround was to override oamSetHiddenInput and oamClearHiddenInput to 
> instead of removing/adding the hidden field from the dom, was to (dis)enabled 
> it instead.  Alternatively clearFormHiddenParams_form could check to see if 
> the hidden field exists before trying to set the value on it.
> Note this error happens in IE7 and not in Firefox 3

-- 
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