html Hidden tag not working in Mac

Discussion in 'Web Design and Development' started by bahrudeen, Jun 4, 2007.

  1. bahrudeen macrumors newbie

    Joined:
    Jun 4, 2007
    #1
    Hi..

    i m new to Mac... i m developing one intranet application in ASP, when i m using hidden tag in the page its working fine in PC, but not in MAC, first i though its because of javascript, but javascript is working fine like client validation script alert and all fine ...but i found the following is problem

    <input type="hidden" value="0" name="CmdAction">

    <%Response.Write "<input type=""image"" onClick=""document.getElementById('CmdAction').value = 'Change Password';"" id=""CmdAct"" name=""CmdAct"" src=""images/save.gif"" >" %>


    in the above code i m assigning the value to hidden Tag "cmdaction" as "Change Password", after submitting the value is taking to next page for password change.. this page work well in PC, but in Mac the value is not getting.....

    strAction = request.Form("CmdAction")

    in Mac "strAction " is empty but in PC i m getting "Change Password"

    can u help me out in this issue.....


    Bahrudeen
     
  2. dcv macrumors G3

    Joined:
    May 24, 2005
    #2
    Is it actually finding the 'CmdAction' element?

    In the code above you've assigned a name of 'CmdAction' but not an id.
     
  3. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #3
    Either add an id attribute to your hidden field, or use

    Code:
    document.getElementsByName('CmdAction')[0].value
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    Yea, what he said. getElementById looks for the id attribute, not the name attribute. Took me a little bit to see it so I can understand the over site.
     
  5. bahrudeen thread starter macrumors newbie

    Joined:
    Jun 4, 2007
    #5
    Working...

    wow its working....... Thanx guys.....
     
  6. bahrudeen thread starter macrumors newbie

    Joined:
    Jun 4, 2007
    #6
    ASP with javascript not working in Mac

    hi..

    sorry for disturb u again....

    i have one input tag , value took from the popup window there by clicking on the text...

    <input size=41 type=text class=""text"" readonly name=" & TbFieldName & " value="""& estlocname &"""><input type=hidden id=" & TbFieldName1 & " name=" & TbFieldName1 &" value="""& estlocid &"""><A HREF='javascript:popWin(""" & TbFieldName & """,""" & TbFieldName1 & """,""Est"")'></a>

    by the above code, javascript func for opening one popup..

    ---------------------
    function PopWin(vField, vFieldId, vParam )
    {

    var nW = window.open("", "popup", "resizable=yes,scrollbars=yes,top=100,left=100,width=650,height=420");
    nW.location.href = "popEst.asp?rqFieldName=" + vField + "&rqFieldID=" + vFieldId + "&Param=" + vParam ;
    nW = null;

    }
    -----------------------------

    in the popEst.asp page,

    im populating all the values from table, if i m click one value from the popup window value should appear in the input tag...

    response.write "<td><left><a href=""javascript:sendback('" & replace(EstName,"'","\'") & "', " & EstID & ")"">" & EstName & "</a></left></td>"

    function sendback(sWo,sWl,sW2,sW3,sW4)
    {

    window.opener.document.all.<%=MainFormFldName%>.value = sWo;
    window.opener.document.all.<%=MainFormFldID%>.value = sWl;
    }

    all the code working fine in PC, but not in Mac.. i found that in javascript, ASP variable is not recognize in Mac..

    window.opener.document.all.<%=MainFormFldName%>.value = sWo;

    in the above line MainFormFldName is showing "varaible undefined" error i m getting when i try to alert the <%=MainFormFldName%> like
    alert (<%=MainFormFldName%>);

    i dnk i wrote lot, but i want to clearly u my problem...

    expecting ur solution......
     
  7. dcv macrumors G3

    Joined:
    May 24, 2005
    #7
    Yeah don't use document.all because if I remember correctly this is only recognised by IE. Use document.getElementById(id) instead to grab your elements.
     

Share This Page