By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,028 Members | 998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,028 IT Pros & Developers. It's quick & easy.

Referencing the value of a input field.

P: n/a
Hello all

I have a HTML control generated by the following:

INPUT TYPE="hidden" NAME="MyAnswer" VALUE=""

Is there a way to reference the Value of this control using VB program code???

Thanks in advance

George

From http://www.developmentnow.com/g/62_0...sp-general.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Sep 28 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a

"George Slamowitz" <GS********@COX.NETwrote in message
news:81**********************************@developm entnow.com...
Hello all

I have a HTML control generated by the following:

INPUT TYPE="hidden" NAME="MyAnswer" VALUE=""

Is there a way to reference the Value of this control using VB program
code???
>
In what context?

In an ASP page which is the action target of the FORM that contains this
INPUT then by default it is accessed as:-

Request.QueryString("MyAnswer")

If the FORM in the html specifies METHOD="POST" then this would be:-

Request.Form("MyAnswer")
Thanks in advance

George

From
http://www.developmentnow.com/g/62_0...sp-general.htm
>
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Sep 28 '06 #2

P: n/a
Anthony

Are you saying that to set the value you would as

"GET" - Request.Form("MyAnswer") = 1 or
"POST" - Request.QueryString("MyAnswer") = 1

and freference the valuue as

"GET" - Answer = Request.Form("MyAnswer") or
"POST" - Answer = Request.QueryString("MyAnswer")

George


From http://www.developmentnow.com/g/62_2...put-field-.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Sep 28 '06 #3

P: n/a

"George Slamowitz" <GS********@COX.NETwrote in message
news:76**********************************@developm entnow.com...
Anthony

Are you saying that to set the value you would as

"GET" - Request.Form("MyAnswer") = 1 or
"POST" - Request.QueryString("MyAnswer") = 1

and freference the valuue as

"GET" - Answer = Request.Form("MyAnswer") or
"POST" - Answer = Request.QueryString("MyAnswer")

George
No first of all you got GET and POST round the wrong way. GET will include
the field values in the querystring so you need Request.QueryString where as
POST puts them in the entity body so you need Request.Form to access them

Secondly this only applies to receiving values from a form submission. To
include initial or current values in a response you need to place them
inline in your response output:-

<INPUT TYPE="hidden" NAME="MyAnswer"
VALUE="<%=Server.HTMLEncode(MyAnswer)>%"

Where MyAnswer is a variable holding the value you want include in the form.
>
From
http://www.developmentnow.com/g/62_2...put-field-.htm
>
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Sep 28 '06 #4

P: n/a
Nope. These collections are read-only. To set the value, you apply it
to the Value attribute in the form, either programmatically or in the
html. To read the value, you do as Anthony said.

Having said that, your use of the term "HTML Control" and VB suggest
you might be doing stuff with Dotnet. If that's the case, you should
be posting to a dotnet group. Reading the value will still be more or
less the same, but setting the value programmatically is totally
different in dotnet to classic ASP.

If you are indeed dotnetting, try
microsoft.public.dotnet.framework.aspnet. If not, and the responses so
far don't light up your bulb, get back to us.

--
Mike Brind

George Slamowitz wrote:
Anthony

Are you saying that to set the value you would as

"GET" - Request.Form("MyAnswer") = 1 or
"POST" - Request.QueryString("MyAnswer") = 1

and freference the valuue as

"GET" - Answer = Request.Form("MyAnswer") or
"POST" - Answer = Request.QueryString("MyAnswer")

George


From http://www.developmentnow.com/g/62_2...put-field-.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Sep 28 '06 #5

P: n/a
Mike: I'm not using .NET ... I'm using ASP/HTML

Anthony:

I tried to create the the Input Control in the body of the document and in an OnClick routine (VB) I have been trying to set the value based upon upon the button selected. But I can't seem to get the value to set ... I changed the "hidden" to "input" where I was able to see the control. When I set the value inside of the
input field all of the other logic I have works like a charm, I am just having a problem setting the field after it is created.

I also tried to create the control ("INPUT") inside of the onclick routine (VB) and remove it from the body of the HTML document, but it did not seem to create it.

Could the problem be that I am trying to access the control inside of an onclick condition???????????

Thanks for all of the help ... this one is really taxing my brain

George

From http://www.developmentnow.com/groups...hreadid=827396

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Sep 29 '06 #6

P: n/a

"George Slamowitz" <GS********@COX.NETwrote in message
news:b8**********************************@developm entnow.com...
Mike: I'm not using .NET ... I'm using ASP/HTML

Anthony:

I tried to create the the Input Control in the body of the document and in
an OnClick routine (VB) I have been trying to set the value based upon upon
the button selected. But I can't seem to get the value to set ... I changed
the "hidden" to "input" where I was able to see the control. When I set the
value inside of the
input field all of the other logic I have works like a charm, I am just
having a problem setting the field after it is created.
>
I also tried to create the control ("INPUT") inside of the onclick routine
(VB) and remove it from the body of the HTML document, but it did not seem
to create it.
>
Could the problem be that I am trying to access the control inside of an
onclick condition???????????
>
We are going to need to see some example code of what you have tried. I
can't make out whether you doing something wrong client side or have
completely missunderstood how server side code works.
Thanks for all of the help ... this one is really taxing my brain

George

From
http://www.developmentnow.com/groups...hreadid=827396
>
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Oct 1 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.