3 Replies Latest reply on Oct 15, 2009 4:43 AM by Ilya Shaikovsky

    HtmlCommandLink file download issue in Firefox

    Paskal Sanil Newbie

      Hi,

      I am facing problem when i have a HtmlCommandLink on a Dialog. This issue is only with FireFox. IE 6 it works just fine.

      <h:outputLink value="#" title="Title1" onclick="return oamSubmitForm('downloadDialog_f','downloadDialog_f:downloadBulkData',null,[['Uri','ExportedData.zip']]);">ExportedData.zip</h:outputLink>


      I use the link on a dialog to download a file "onClick". Issue is when i click on the Link, actually it should ask whether to save the file. But it doesn't in Firefox.

      On debugging a bit, i found that

      oamSubmitForm() --calls-> oamSetHiddenInput().

      oamSetHiddenInput() tries to get the formname which its not able to find.
      var form = document.forms[formName];

      [ Please note that Dialog itself has a form by itself in the hierarchy.]

      When i replaced it to :

      var form = document.getElementById(formName);

      It worked.

      Is there any bug in Richfaces javascript? If YES, is there any fix available for this.
      If NO, is there a way i can bypass calling default script and call my own javascript function?

      Thanks in advance for your help,
      paskal

        • 1. Re: HtmlCommandLink file download issue in Firefox
          Ilya Shaikovsky Master

          Show source page code. I'm not sure about which RichFaces js you talking about.

          • 2. Re: HtmlCommandLink file download issue in Firefox
            Paskal Sanil Newbie

            Hope this is what u are looking for:


            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
            <html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="http://openfaces.org">
            
            <head>
             <link class="component" href="/richclient/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" rel="stylesheet" type="text/css" /><link class="component" href="/richclient/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><script src="/richclient/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.AjaxScript.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.PrototypeScript.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/utils.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/browser_info.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/modalPanel.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/modalPanelBorders.js.wtk" type="text/javascript"></script><link class="component" href="/richclient/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/modalPanel.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" rel="stylesheet" type="text/css" /><script src="/richclient/a4j/g/3_3_0.GAorg/ajax4jsf/javascript/scripts/form.js.wtk" type="text/javascript"></script><link class="component" href="/richclient/a4j/s/3_3_0.GAcss/panel.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" rel="stylesheet" type="text/css" /><script src="/richclient/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.ImageCacheScript.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAscripts/tabPanel.js.wtk" type="text/javascript"></script><link class="component" href="/richclient/a4j/s/3_3_0.GAcss/tabPanel.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" rel="stylesheet" type="text/css" /><link class="component" href="/richclient/a4j/s/3_3_0.GAcss/toolBar.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" rel="stylesheet" type="text/css" /><script src="/richclient/a4j/g/3_3_0.GAscripts/menu.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/json/json-dom.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/context-menu.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/available.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/jquery/jquery.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/data-table.js.wtk" type="text/javascript"></script><link class="component" href="/richclient/a4j/s/3_3_0.GAcss/table.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" rel="stylesheet" type="text/css" /><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/script/controlUtils.js.wtk" type="text/javascript"></script><link class="component" href="/richclient/a4j/s/3_3_0.GAcss/dropdownmenu.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" rel="stylesheet" type="text/css" /><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/form.js.wtk" type="text/javascript"></script><link class="component" href="/richclient/a4j/s/3_3_0.GAcss/menucomponents.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" rel="stylesheet" type="text/css" /><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/json/json-mini.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.DnDScript.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/dnd/dnd-common.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/events.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/tree.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/tree-selection.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/tree-item.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/tree-item-dnd.js.wtk" type="text/javascript"></script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/drag-indicator.js.wtk" type="text/javascript"></script><link class="component" href="/richclient/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/dragIndicator.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" rel="stylesheet" type="text/css" /><link class="component" href="/richclient/a4j/s/3_3_0.GAcss/tree.xcss/DATB/eAELXT5DOhSIAQ!sA18_.wtk" rel="stylesheet" type="text/css" /><script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script><script src="/richclient/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/skinning.js.wtk" type="text/javascript"></script><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
            
             <title>SimManager Enterprise</title><link rel="stylesheet" type="text/css" href="/richclient/themes/Default/common.css" /><link rel="stylesheet" type="text/css" href="/richclient/themes/Default/wizard.css" /><link rel="stylesheet" type="text/css" href="/richclient/themes/Default/workbench.css" /><link rel="stylesheet" type="text/css" href="/richclient/themes/Default/banner.css" /><link rel="stylesheet" type="text/css" href="/richclient/themes/Default/openfaces.css" /><link rel="stylesheet" type="text/css" href="/richclient/themes/Default/richfaces.css" /><link rel="stylesheet" type="text/css" href="/richclient/themes/Default/wcomposite.css" /><link rel="stylesheet" type="text/css" href="/richclient/themes/Default/wprimary.css" />
            
             <script type="text/javascript" src="../js/DD_roundies.js"><!--
            
            //--></script>
             <script><!--
            
             /* IE only */
             DD_roundies.addRule('.SrchPnlCntr', '10px');
            
            //--></script>
            
            
            </head>
            <body class="Banner"><div id="a" class="application"><form id="form" name="form" method="post" action="/richclient/facelets/main/application.xhtml" enctype="application/x-www-form-urlencoded"><script id="form:j_id14" type="text/javascript"><!--
            //<![CDATA[
             showOptionsPage=function(){A4J.AJAX.Submit('_viewRoot','form',null,{'parameters':{'form:j_id14':'form:j_id14'} ,'actionUrl':'/richclient/facelets/main/application.xhtml','similarityGroupingId':'form:j_id14'} )};
             //]]>
            //--></script><div class="BannerHeaderR4"><div class="BannerLogoPortalNameR4"><img src="/richclient/themes/Default/images/banner/logo.gif" alt="SimManager Enterprise" /></div><div class="BannerPortalNameR4"><span class="BannerTxtBoldR4">Enterprise Edition <span class="BannerVersion">(V14-CL2852X)</span></span></div><div class="BannerLocaleTxtR4"><span class="OutputText">Logged in as SimMan (DefaultUserProfile)</span><a href="" onclick="showOptionsPage();return false;" class="BannerLocaleTxtR4"><span class="OutputText">Options</span></a><a href="xxx" class="BannerLocaleTxtR4"><span class="OutputText">Support</span></a><script type="text/javascript"><!--
            
            
             function oamSetHiddenInput(formname, name, value)
             {
             var form = document.forms[formname];
             if(typeof form.elements[name]!='undefined' && form.elements[name].nodeName=='INPUT')
             {
             form.elements[name].value=value;
             }
             else
             {
             var newInput = document.createElement('input');
             newInput.setAttribute('type','hidden');
             newInput.setAttribute('id',name);
             newInput.setAttribute('name',name);
             newInput.setAttribute('value',value);
             form.appendChild(newInput);
             }
            
             }
            
            
             function oamClearHiddenInput(formname, name, value)
             {
             var form = document.forms[formname];
             var hInput = form.elements[name];
             if(typeof hInput !='undefined')
             {
             form.removeChild(hInput);
             }
            
             }
            
             function oamSubmitForm(formName, linkId, target, params)
             {
            
             var clearFn = 'clearFormHiddenParams_'+formName.replace(/-/g, '\$:').replace(/:/g,'_');
             if(typeof window[clearFn] =='function')
             {
             window[clearFn](formName);
             }
            
             if(typeof window.getScrolling!='undefined')
             {
             oamSetHiddenInput(formName,'autoScroll',getScrolling());
             }
            
             var form = document.forms[formName];
             var oldTarget = form.target;
             if(target != null)
             {
            
             form.target=target;
             }
             if((typeof params!='undefined') && params != null)
             {
            
             for(var i=0, param; (param = params); i++)
             {
             oamSetHiddenInput(formName,param[0], param[1]);
             }
            
             }
            
             oamSetHiddenInput(formName,formName +':'+'_idcl',linkId);
            
             if(form.onsubmit)
             {
             var result=form.onsubmit();
             if((typeof result=='undefined')||result)
             {
             try
             {
             form.submit();
             }
             catch(e){}
             }
            
             }
             else
             {
             try
             {
             form.submit();
             }
             catch(e){}
             }
            
             form.target=oldTarget;
             if((typeof params!='undefined') && params != null)
             {
            
             for(var i=0, param; (param = params); i++)
             {
             oamClearHiddenInput(formName,param[0], param[1]);
             }
            
             }
            
             oamClearHiddenInput(formName,formName +':'+'_idcl',linkId);return false;
             }
            
            
            //--></script><a href="#" onclick="var cf = function(){if(!processHelp()) return false;};var oamSF = function(){return oamSubmitForm('form','form:j_id29','_top',[]);};return (cf()==false)? false : oamSF();" target="_top" class="BannerLocaleTxtR4"><span class="OutputText">Help</span></a>
            
            <input type="hidden" name="autoScroll" />
            <a class="BannerLocaleTxtR4" href="#" id="form:j_id31" name="form:j_id31" onclick="if(!confirmLogoff()) return false;;A4J.AJAX.Submit('_viewRoot','form',event,{'parameters':{'form:j_id31':'form:j_id31'} ,'actionUrl':'/richclient/facelets/main/application.xhtml','similarityGroupingId':'form:j_id31'} );return false;"><span class="OutputText">Log Off</span></a></div></div><input type="hidden" id="form:confirmMsg" name="form:confirmMsg" value="Are you sure you want to log off?" /><input type="hidden" id="form:errorMsg" name="form:errorMsg" value="The search string cannot be empty. Enter a valid search string." /><input type="hidden" name="form_SUBMIT" value="1" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAVqX2lkM3B0AC0vcG9ydGFscy9CYXNlL2ZhY2VsZXRzL21haW4vYXBwbGljYXRpb24ueGh0bWw=" /></form><div id="myWorkspaceActionDialog" style="display: none;"><input id="myWorkspaceActionDialogOpenedState" name="myWorkspaceActionDialogOpenedState" type="hidden" /><div class="rich-modalpanel " id="myWorkspaceActionDialogContainer" style="position: absolute; display: none; z-index: 100; background-color: inherit;"><div class="dr-mpnl-mask-div dr-mpnl-mask-div-opaque rich-mpnl-mask-div" id="myWorkspaceActionDialogDiv" style="z-index: 1;"><button class="dr-mpnl-pnl-button" id="myWorkspaceActionDialogFirstHref"></button></div><div class="dr-mpnl-panel rich-mpnl_panel"><div id="myWorkspaceActionDialogCDiv" style="position: absolute; left: 0px; top: 0px; z-index: 9;"><div class="dr-mpnl-shadow rich-mpnl-shadow" id="myWorkspaceActionDialogShadowDiv"></div><div class=" dr-mpnl-pnl rich-mp-content" id="myWorkspaceActionDialogContentDiv"><table border="0" cellpadding="0" cellspacing="0" id="myWorkspaceActionDialogContentTable" style="width: 1px;height: 1px;"><tr style="height: 99%"><td class="dr-mpnl-pnl-b rich-mpnl-body" valign="top"><form id="myWorkspaceActionDialog-f" name="myWorkspaceActionDialog-f" method="post" enctype="multipart/form-data" action="/richclient/facelets/main/application.xhtml"><input type="hidden" name="myWorkspaceActionDialog-f" value="myWorkspaceActionDialog-f" /><input type="hidden" name="autoScroll" value="" /><input type="hidden" name="myWorkspaceActionDialog-f:_link_hidden_" value="" /><input type="hidden" name="myWorkspaceActionDialog-f:j_idcl" value="" /><script type="text/javascript"><!--
            function clear_myWorkspaceActionDialog_2Df() {
            _clearJSFFormParameters('myWorkspaceActionDialog-f','',['myWorkspaceActionDialog-f:_link_hidden_','myWorkspaceActionDialog-f:j_idcl']);
            }
            function clearFormHiddenParams_myWorkspaceActionDialog_2Df(){clear_myWorkspaceActionDialog_2Df();}
            function clearFormHiddenParams_myWorkspaceActionDialog$_f(){clear_myWorkspaceActionDialog_2Df();}
            clear_myWorkspaceActionDialog_2Df();
            //--></script>
            
            ...
            


            • 3. Re: HtmlCommandLink file download issue in Firefox
              Ilya Shaikovsky Master

              no, I'm asking your sources and not generated html.