PDA

View Full Version : html Hidden tag not working in Mac




bahrudeen
Jun 4, 2007, 06:25 AM
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



dcv
Jun 4, 2007, 06:34 AM
<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"" >" %>




Is it actually finding the 'CmdAction' element?

In the code above you've assigned a name of 'CmdAction' but not an id.

jeremy.king
Jun 4, 2007, 12:03 PM
Either add an id attribute to your hidden field, or use

document.getElementsByName('CmdAction')[0].value

angelwatt
Jun 4, 2007, 09:16 PM
Either add an id attribute to your hidden field, or use

document.getElementsByName('CmdAction')[0].value

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.

bahrudeen
Jun 5, 2007, 01:54 AM
wow its working....... Thanx guys.....

bahrudeen
Jun 5, 2007, 09:04 AM
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......

dcv
Jun 5, 2007, 09:10 AM
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.