Firefox setting hidden input error.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • corykendall
    New Member
    • Feb 2008
    • 2

    Firefox setting hidden input error.

    Here is my code:

    ...
    Setting hidden input to: <dsp:valueof param="tabname"/>
    <input name="tabname" type="hidden" value='<dsp:val ueof param="tabname"/>'/>
    </dsp:form>

    hidden input set to:<script language="JavaS cript"> document.write( document.getEle mentById("tab_s witchRefreshFor m").elements.ta bname.value);</script><BR/>

    Now when I'm in IE, everything works fine and the output is as follows:

    Setting hidden input to: moreDetails
    hidden input set to:moreDetails

    However in firefoc the output is:

    Setting hidden input to: moreDetails
    hidden input set to:features

    Huh? "features" is another valid entry for this field, but I feel that this code is pretty straight forward. is the value attribute for hidden fields broken for firefox?!??
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    Originally posted by corykendall
    Huh? "features" is another valid entry for this field, but I feel that this code is pretty straight forward. is the value attribute for hidden fields broken for firefox?!??
    How could Firefox know that there's some other valid entry too. There must something wrong out of this snippet. You may post more code, so that its easy to tack the problem.

    * Include your code in CODE tags.

    Comment

    • corykendall
      New Member
      • Feb 2008
      • 2

      #3
      Originally posted by hsriat
      How could Firefox know that there's some other valid entry too. There must something wrong out of this snippet. You may post more code, so that its easy to tack the problem.

      * Include your code in CODE tags.
      Alright, here's some more information. This is the file "tab_switchRefr eshForm.jspf":

      Code:
      <dsp:form formid="tab_switchRefreshForm" id="tab_switchRefreshForm" method="post"
                action="${originatingRequest.contextPath}/browse/gadgets/moreDetails_display.jsp">
        <input name="product" type="hidden" value='<dsp:valueof param="product"/>'/>
        <input name="productId" type="hidden" value='<dsp:valueof param="product.repositoryId"/>'/>
        <input name="sku" type="hidden" value='<dsp:valueof param="sku"/>'/>
        Setting hidden input to: <dsp:valueof param="tabname"/>
        <input name="tabname" type="hidden" value='<dsp:valueof param="tabname"/>' />
      </dsp:form>
      
      hidden input set to:<script language="JavaScript"> document.write(document.getElementById("tab_switchRefreshForm").elements.tabname.value);</
      script><BR/>
      Then there is a file which calls it, which I'm showing a simplified version of:

      Code:
      <div id="moreDetailsTabs">
        <%@include file="tab_switchRefreshForm.jspf"%>
        ...
      <dsp:a href="javascript:void(0)" onclick="productTabs.clickTab('features')">
      </div>
        ...
      <dsp:a href="javascript:void(0)" onclick="productTabs.clickTab('moreDetails')">
        ...
      </div>
      And finally, the javascript, in its own file (provided using dojo)

      Code:
      productTabs={
      
          //called when a user clicks a tab
          clickTab: function(tabname) {
          var form = dojo.byId("tab_switchRefreshForm");
          var currentTab = form.elements.tabname.value;
      
      
          //If the same tab was clicked as is already showing, do nothing
          if(currentTab === tabname) {
              return;
          }
          
          //set the new selected tab in the refresh form and submit it
          
          form.elements.tabname.value = tabname;
          var thisInstance = productTabs;
          
          thisInstance.submitRefreshForm();
          },
      
          submitRefreshForm: function()
          {
            dojo.io.bind({
            load: function(type, data,evt){
              var divProductTabs = dojo.byId("moreDetailsTabs");
              divProductTabs.innerHTML = data;
              
              dojo.widget.byId('richCart').hijackAllAddToCartNodes();
              },
            formNode: dojo.byId("tab_switchRefreshForm")
            });  
          }
      };
      The functionality I'm getting is it's working fine in IE, but in FF we get some weird errors. It thinks that it is selecting the wrong tab to begin with (The error I initially stated). When you click on a tab for the first time, everything works fine. The page partially refreshes with only the contents of the tabbed area being changed. However, when you click a tab for the second time, the entire area disapears, and is permanently gone.

      I realize that this is rather complex, and I perhaps have provided insufficient code still, but more would probably just be too much for people to help me with in their free time :).

      Any help?

      Comment

      Working...