simple simple question

O

Oli

Hi Folks,

Alright, I have a textbox called "A" and the value in that textbox is "B".

When the user presses submit I want A : B to appear on the page. How do I
do it?

I appreciate that this is very basic stuff, but I got to start somewhere!

Cheers (TIA)
Oli
 
B

Bob Barrows

Oli said:
Hi Folks,

Alright, I have a textbox called "A" and the value in that textbox is
"B".

When the user presses submit I want A : B to appear on the page. How
do I do it?
On what page? The page to which you are submitting the request? If so, do
this:

<%
response.write "A:" & Request.Form("A")
%>

HTH,
Bob Barrows
 
R

Rob Meade

...
Alright, I have a textbox called "A" and the value in that textbox is "B".

When the user presses submit I want A : B to appear on the page. How do I
do it?

Hi Oli,

Ok - well two ways I guess, if you *know* that the textbox is called B, and
you dont need this to be dynamic then :

<%
Response.Write "B: " & Request.Form("B")
%>

The above writes the text B: to the page and then gets the value from the
submitted form data for the element name B

If you do not *know* that the element will be called B and you wanted to
display ALL fields etc, you could iterate through the form collection, check
out

http://www.aspfaq.com/show.asp?id=2036


Hope this helps,

Regards

Rob
 
E

Evertjan.

Oli wrote on 26 jan 2004 in microsoft.public.inetserver.asp.general:
Alright, I have a textbox called "A" and the value in that textbox is
"B".

When the user presses submit I want A : B to appear on the page. How
do I do it?

I appreciate that this is very basic stuff, but I got to start
somewhere!

If you mean the same page, it has nothing to do with ASP, which is
serverside code.

Please see a clientside NG.
 
P

Phill. W

.. . .
I have a textbox called "A" and the value in that textbox is "B".
When the user presses submit I want A : B to appear on the page.

I /think/ what you want is something like

either
' using method=POST
Response.Write Request.Form
or
' using method=GET
Response.Write Request.QueryString

depending on the "method" attribute in your Form tag.

HTH,
Phill W.
 
O

Oli

Thanks guys - problem I have is the name of the textbox is always
different!! Bascially im trying to achieve:

TEXTBOX_NAME = TEXTBOX VALUE

Any ideas?
 
R

Randy Rahbar

Thanks guys - problem I have is the name of the textbox is always
different!! Bascially im trying to achieve:

TEXTBOX_NAME = TEXTBOX VALUE

Any ideas?

How about iterating through the list and showing them all...

For Each x In Request.Form
Response.Write x " = " & Request.Form(x)
Next
 
B

Bob Barrows

Oli said:
Thanks guys - problem I have is the name of the textbox is always
different!! Bascially im trying to achieve:

TEXTBOX_NAME = TEXTBOX VALUE

Any ideas?

Come on. It's covered in the link that Rob provided:

Bob Barrows
 
C

Chris Hohmann

Oli said:
is How do
I B, collection,
Thanks guys - problem I have is the name of the textbox is always
different!! Bascially im trying to achieve:

TEXTBOX_NAME = TEXTBOX VALUE

Any ideas?

I believe Rob addresses this at the bottom of his reply. If you don't
know what the name of the element is, you can iterate the entire
Request.Form collection as detailed in the referenced article.

-Chris Hohmann
 
R

Roland Hall

:
: Alright, I have a textbox called "A" and the value in that textbox is "B".
: When the user presses submit I want A : B to appear on the page. How do I
: do it?

Hi Oli...

You do it on the client-side. If you do it on the server-side, then you go
back to the server or at the very least unnecessarily reload the page or
another page. If the user is involved, you're working with the client, not
the server. Unless you need anything from the server, it is better to do it
on the client-side. If you do need something from the server, then it is
best to do it when the page loads, if possible.

If this is for the Internet, then javascript would be the language of
choice. If on an intranet and the browser is IE, it could be
javascript/jscript or vbscript. Not having this information makes it hard
to supply code for a specific language.

More information needed is how you want the information displayed. Stating,
"I want A:B to appear on the page" is vague. The reason is document.write
would replace all information on a page.

<form id=form1 onSubmit="document.write(A.name+':'+A.value)">
<input id="A" name="A" value="" />
<input type=submit id=submit1 name=submit1 value="Submit">
</form>

Setting the value or the innerText/innerHTML of a tag could render the value
to be shown within the current page.

<label id=label1>&nbsp;</label><br />
<form id=form1 onSubmit="document.getElementById("label1").innerText
=A.name+':'+A.value; return false">
<input id="A" name="A" value="" />
<input type=submit id=submit1 name=submit1 value="Submit">
</form>

Since you didn't say the user inputs the value, it could already be there.
You could already have what you want to show hidden and when the user clicks
submit, reveal it.

<html>
<head>
<title></title>
<script type="text/javascript">
function fillLabel(a, b) {
document.getElementById('label1').innerText=a+":"+b;
}
</script>
</head>
<body
onload="fillLabel(document.getElementById('A').name,document.getElementById(
'A').value)">
<label id=label1 style="display: none"></label>
<form id=form1
onSubmit="document.getElementById('label1').style.display='block'; return
false">
<input id="A" name="A" value="B" />
<input type=submit id=submit1 name=submit1 value="Submit" />
</form>
</body>
</html>

Since this is not an ASP-related question, I have set the followups to:
microsoft.public.scripting.jscript

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top