472,103 Members | 1,067 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,103 software developers and data experts.

problem setting hidden field value

PJ6
From a control's onkeypress the below javascript snippet is executed. I am
attmpting to set the value of a hidden field... I believe I'd be able to get
the contents of the hidden field by using
"Page.Request.Item(MyHiddenFieldName)" sever-side, no? Unfortunately the
field doesn't look like it's even being set. Is there something special I
need to do?

TIA,
Paul

----------------------------

if (event.keyCode == 13)
{
event.returnValue=false;
event.cancelBubble = true;
document.forms[0].MyHiddenFieldName.Value='something';
document.forms[0].submit();
}
Nov 30 '05 #1
4 5840
"PJ6" wrote ....
From a control's onkeypress the below javascript snippet is executed. I am
attmpting to set the value of a hidden field... I believe I'd be able to
get the contents of the hidden field by using
"Page.Request.Item(MyHiddenFieldName)" sever-side, no?
After the page is submitted, yes, I've always used:

Dim hiddenValue as string

hiddenValue = Request.Form("hiddenFieldName")
Unfortunately the field doesn't look like it's even being set. Is there
something special I need to do?


You could always change the hidden field to a normal text box, just
temporarily, then you would actually "see" if the javascript was setting the
value of the control.
Nov 30 '05 #2
your client script is wrong. javascript is case sensitive you you are
dynamically creating a "Value" property and setting its value. of cource
this is not posted back. try:

document.forms[0].MyHiddenFieldName.value='something';
-- bruce (sqlwork.com)
"PJ6" <no****@nowhere.net> wrote in message
news:e0**************@TK2MSFTNGP14.phx.gbl...
From a control's onkeypress the below javascript snippet is executed. I am
attmpting to set the value of a hidden field... I believe I'd be able to
get the contents of the hidden field by using
"Page.Request.Item(MyHiddenFieldName)" sever-side, no? Unfortunately the
field doesn't look like it's even being set. Is there something special I
need to do?

TIA,
Paul

----------------------------

if (event.keyCode == 13)
{
event.returnValue=false;
event.cancelBubble = true;
document.forms[0].MyHiddenFieldName.Value='something';
document.forms[0].submit();
}

Nov 30 '05 #3
PJ6
I changed it as you suggested but the value still isn't being set. :(

The funny thing is, when I remove the hidden field, I get a JavaScript
error, so I know it's being referenced properly. Really wierd.

Paul

"Bruce Barker" <br******************@safeco.com> wrote in message
news:%2*****************@TK2MSFTNGP10.phx.gbl...
your client script is wrong. javascript is case sensitive you you are
dynamically creating a "Value" property and setting its value. of cource
this is not posted back. try:

document.forms[0].MyHiddenFieldName.value='something';
-- bruce (sqlwork.com)
"PJ6" <no****@nowhere.net> wrote in message
news:e0**************@TK2MSFTNGP14.phx.gbl...
From a control's onkeypress the below javascript snippet is executed. I
am attmpting to set the value of a hidden field... I believe I'd be able
to get the contents of the hidden field by using
"Page.Request.Item(MyHiddenFieldName)" sever-side, no? Unfortunately the
field doesn't look like it's even being set. Is there something special I
need to do?

TIA,
Paul

----------------------------

if (event.keyCode == 13)
{
event.returnValue=false;
event.cancelBubble = true;
document.forms[0].MyHiddenFieldName.Value='something';
document.forms[0].submit();
}


Nov 30 '05 #4
PJ6
I got it. Foudn a server-side, now it works a treat.

Thanks,
Paul

"PJ6" <no****@nowhere.net> wrote in message
news:e5**************@tk2msftngp13.phx.gbl...
I changed it as you suggested but the value still isn't being set. :(

The funny thing is, when I remove the hidden field, I get a JavaScript
error, so I know it's being referenced properly. Really wierd.

Paul

"Bruce Barker" <br******************@safeco.com> wrote in message
news:%2*****************@TK2MSFTNGP10.phx.gbl...
your client script is wrong. javascript is case sensitive you you are
dynamically creating a "Value" property and setting its value. of cource
this is not posted back. try:

document.forms[0].MyHiddenFieldName.value='something';
-- bruce (sqlwork.com)
"PJ6" <no****@nowhere.net> wrote in message
news:e0**************@TK2MSFTNGP14.phx.gbl...
From a control's onkeypress the below javascript snippet is executed. I
am attmpting to set the value of a hidden field... I believe I'd be able
to get the contents of the hidden field by using
"Page.Request.Item(MyHiddenFieldName)" sever-side, no? Unfortunately the
field doesn't look like it's even being set. Is there something special
I need to do?

TIA,
Paul

----------------------------

if (event.keyCode == 13)
{
event.returnValue=false;
event.cancelBubble = true;
document.forms[0].MyHiddenFieldName.Value='something';
document.forms[0].submit();
}



Nov 30 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jim | last post: by
7 posts views Thread by exxos | last post: by
2 posts views Thread by Guadala Harry | last post: by
8 posts views Thread by Efi Merdler | last post: by
2 posts views Thread by sorobor | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.