473,625 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to retrieve elements on next form

Hi,

I have a form with the following elements:
first form
<input type='text' name='addr1' value='1223 westward'>
<input type='text' name='addr2' value='12 admirals rd'>
<input type='text' name='addr3' value='90 Northward'>
<input type='text' name='addr4' value='apt 12 34 Marine way'>
<input type='text' name='addr5' value='2nd floor 900 Main St'>

on submit the form will post them to the next form.

second form
<%
while i < 5
response.write( "address " & i & " = " & request.form("a ddr" + i) &
chr(13))
i = i + 1
wend
%>

Is the syntax correct to get the values? I tried it but I dont get any
values for the request.
If it is not the correct syntax, what should it be so I will be able to see
it when the first form posts it to the second one?

thanks,
Will
Jul 19 '05 #1
10 1547
> while i < 5

With this statement, your 5th address will never be written. Change it to...

while i < 6
response.write( "address " & i & " = " & request.form("a ddr" + i) &
chr(13))
Change the above line to...
response.write( "address " & i & " = " & request.form("a ddr" & i) & chr(13))

(notice the "&" replacing the "+")

Randy

"wk6pack" <wk***@sd61.bc. ca> wrote in message
news:Ol******** ******@TK2MSFTN GP10.phx.gbl... Hi,

I have a form with the following elements:
first form
<input type='text' name='addr1' value='1223 westward'>
<input type='text' name='addr2' value='12 admirals rd'>
<input type='text' name='addr3' value='90 Northward'>
<input type='text' name='addr4' value='apt 12 34 Marine way'>
<input type='text' name='addr5' value='2nd floor 900 Main St'>

on submit the form will post them to the next form.

second form
<% response.write( "address " & i & " = " & request.form("a ddr" + i) &
chr(13))
i = i + 1
wend
%>

Is the syntax correct to get the values? I tried it but I dont get any
values for the request.
If it is not the correct syntax, what should it be so I will be able to see it when the first form posts it to the second one?

thanks,
Will

Jul 19 '05 #2
Hi Randy,

That didnt work. I get nothing coming back.

Will
"Randy Rahbar" <rvrahbar@_JUNK ETY_JUNK_hotmai l.com> wrote in message
news:Of******** ******@TK2MSFTN GP09.phx.gbl...
while i < 5
With this statement, your 5th address will never be written. Change it

to...
while i < 6
response.write( "address " & i & " = " & request.form("a ddr" + i) &
chr(13))
Change the above line to...
response.write( "address " & i & " = " & request.form("a ddr" & i) &

chr(13))
(notice the "&" replacing the "+")

Randy

"wk6pack" <wk***@sd61.bc. ca> wrote in message
news:Ol******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I have a form with the following elements:
first form
<input type='text' name='addr1' value='1223 westward'>
<input type='text' name='addr2' value='12 admirals rd'>
<input type='text' name='addr3' value='90 Northward'>
<input type='text' name='addr4' value='apt 12 34 Marine way'>
<input type='text' name='addr5' value='2nd floor 900 Main St'>

on submit the form will post them to the next form.

second form
<%

response.write( "address " & i & " = " & request.form("a ddr" + i) &
chr(13))
i = i + 1
wend
%>

Is the syntax correct to get the values? I tried it but I dont get any
values for the request.
If it is not the correct syntax, what should it be so I will be able to

see
it when the first form posts it to the second one?

thanks,
Will


Jul 19 '05 #3
"wk6pack" <wk***@sd61.bc. ca> wrote in message
news:Ol******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I have a form with the following elements:
first form
<input type='text' name='addr1' value='1223 westward'>
<input type='text' name='addr2' value='12 admirals rd'>
<input type='text' name='addr3' value='90 Northward'>
<input type='text' name='addr4' value='apt 12 34 Marine way'>
<input type='text' name='addr5' value='2nd floor 900 Main St'>

on submit the form will post them to the next form.

second form
<%
while i < 5
response.write( "address " & i & " = " & request.form("a ddr" + i) &
chr(13))
i = i + 1
wend
%>

Is the syntax correct to get the values? I tried it but I dont get any
values for the request.
If it is not the correct syntax, what should it be so I will be able to see it when the first form posts it to the second one?


This should do what you want:

<%
i = 1
while i < 5
frmStr = "addr" & i
Response.Write( "address " & i & " = " & Request.Form(fr mStr) & "<br>")
i = i + 1
wend
%>
Note that another option might be to interate through the Form collection,
but it will also include the submit button, and any other form inputs
<%:
For Each item in Request.Form
Response.Write( item & " = " & Request.Form(it em) & "<br>")
Next
%>

Regards,
Peter Foti
Jul 19 '05 #4
Oops, I forgot 2 things....
1. Set i to 1 before the loop
2. Do while i < 6 instead of 5.

Thus, first 3 lines should be:
<%
i = 1
while i < 6

The rest remains the same.
Regards,
Peter
"Peter Foti" <pe***@Idontwan tnostinkingemai lfromyou.com> wrote in message
news:10******** *****@corp.supe rnews.com...
"wk6pack" <wk***@sd61.bc. ca> wrote in message
news:Ol******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I have a form with the following elements:
first form
<input type='text' name='addr1' value='1223 westward'>
<input type='text' name='addr2' value='12 admirals rd'>
<input type='text' name='addr3' value='90 Northward'>
<input type='text' name='addr4' value='apt 12 34 Marine way'>
<input type='text' name='addr5' value='2nd floor 900 Main St'>

on submit the form will post them to the next form.

second form
<%
while i < 5
response.write( "address " & i & " = " & request.form("a ddr" + i) &
chr(13))
i = i + 1
wend
%>

Is the syntax correct to get the values? I tried it but I dont get any
values for the request.
If it is not the correct syntax, what should it be so I will be able to

see
it when the first form posts it to the second one?


This should do what you want:

<%
i = 1
while i < 5
frmStr = "addr" & i
Response.Write( "address " & i & " = " & Request.Form(fr mStr) & "<br>")
i = i + 1
wend
%>
Note that another option might be to interate through the Form collection,
but it will also include the submit button, and any other form inputs
<%:
For Each item in Request.Form
Response.Write( item & " = " & Request.Form(it em) & "<br>")
Next
%>

Regards,
Peter Foti

Jul 19 '05 #5
My understanding is that

"addr" & i

would have a space in the string, as i would have a positive or negative
indicator. That is, if i was 1 then it's value as a string would be " 1"
because of the missing + sign.

If you just want to pass your form data along. Try something like....

Dim field
for each field in Request.Form
Response.Write "<input type=hidden name=""" & field & """ value=""" &
Request.Form(fi eld) & """>"
next
"Randy Rahbar" <rvrahbar@_JUNK ETY_JUNK_hotmai l.com> wrote in message
news:Of******** ******@TK2MSFTN GP09.phx.gbl...
while i < 5
With this statement, your 5th address will never be written. Change it

to...
while i < 6
response.write( "address " & i & " = " & request.form("a ddr" + i) &
chr(13))
Change the above line to...
response.write( "address " & i & " = " & request.form("a ddr" & i) &

chr(13))
(notice the "&" replacing the "+")

Randy

"wk6pack" <wk***@sd61.bc. ca> wrote in message
news:Ol******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I have a form with the following elements:
first form
<input type='text' name='addr1' value='1223 westward'>
<input type='text' name='addr2' value='12 admirals rd'>
<input type='text' name='addr3' value='90 Northward'>
<input type='text' name='addr4' value='apt 12 34 Marine way'>
<input type='text' name='addr5' value='2nd floor 900 Main St'>

on submit the form will post them to the next form.

second form
<%

response.write( "address " & i & " = " & request.form("a ddr" + i) &
chr(13))
i = i + 1
wend
%>

Is the syntax correct to get the values? I tried it but I dont get any
values for the request.
If it is not the correct syntax, what should it be so I will be able to

see
it when the first form posts it to the second one?

thanks,
Will


Jul 19 '05 #6
"wk6pack" wrote:
: I have a form with the following elements:
: first form
: <input type='text' name='addr1' value='1223 westward'>
: <input type='text' name='addr2' value='12 admirals rd'>
: <input type='text' name='addr3' value='90 Northward'>
: <input type='text' name='addr4' value='apt 12 34 Marine way'>
: <input type='text' name='addr5' value='2nd floor 900 Main St'>
:
: on submit the form will post them to the next form.
:
: second form
: <%
: while i < 5
: response.write( "address " & i & " = " & request.form("a ddr" + i) &
: chr(13))
: i = i + 1
: wend
: %>
:
: Is the syntax correct to get the values? I tried it but I dont get any
: values for the request.
: If it is not the correct syntax, what should it be so I will be able to
see
: it when the first form posts it to the second one?

Will, I assume when you say 'second form' you mean page. When you're
working with forms you should show all relevant code since <form ...> is
usually the area of interest.

This is a workable solution.

[first.asp]
----------
<%@ Language=VBScri pt %>
<%
Option Explicit
Response.Buffer = True
%>
<html>
<head>
<script type="text/javascript">
function validate() {
var a = new Array(4);
for(i=0; i<5; i++) {
a[i] = document.getEle mentById("addr" +(i+1))
if(!a[i].value) {
alert(a[i].id + " cannot be blank");
a[i].focus();
return false;
}
}
document.form1. action="/lab/next.asp";
document.form1. submit();
return true;
}
</script>
<body>
<form id="form1" name="form1" method="post" onSubmit="retur n validate()">
<input id="addr1" type='text' name='addr1' value='1223 westward' /><br />
<input id="addr2" type='text' name='addr2' value='12 admirals rd' /><br />
<input id="addr3" type='text' name='addr3' value='90 Northward' /><br />
<input id="addr4" type='text' name='addr4' value='apt 1234 Marine way' /><br
/>
<input id="addr5" type='text' name='addr5' value='2nd floor 900 Main St'
/><br />
<input id="submit1" type="submit" name="submit1" value="submit" />
<input id="reset1" type="reset" name="reset1" value="reset" /><br />
</form>
</body>
</html>

[next.asp]
----------
<%@ Language=VBScri pt %>
<%
Option Explicit
Response.Buffer = True
dim info(5)
dim i
for i = 1 to 5
info(i)=Request .Form("addr" & i)
Response.Write( "Address " & i & " = " & info(i) & "<br />" & vbCrLf)
next
%>

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
Jul 19 '05 #7
"Tom B" <sh*****@NOSPAM hotmail.com> wrote in message
news:O%******** ********@TK2MSF TNGP10.phx.gbl. ..
My understanding is that

"addr" & i

would have a space in the string, as i would have a positive or negative
indicator. That is, if i was 1 then it's value as a string would be " 1"
because of the missing + sign.


No, you are incorrect. The string value of 1 is "1".

Regards,
Peter Foti
Jul 19 '05 #8
Thanks Peter, that works great now.
Will

"Peter Foti" <pe***@Idontwan tnostinkingemai lfromyou.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Oops, I forgot 2 things....
1. Set i to 1 before the loop
2. Do while i < 6 instead of 5.

Thus, first 3 lines should be:
<%
i = 1
while i < 6

The rest remains the same.
Regards,
Peter
"Peter Foti" <pe***@Idontwan tnostinkingemai lfromyou.com> wrote in message
news:10******** *****@corp.supe rnews.com...
"wk6pack" <wk***@sd61.bc. ca> wrote in message
news:Ol******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I have a form with the following elements:
first form
<input type='text' name='addr1' value='1223 westward'>
<input type='text' name='addr2' value='12 admirals rd'>
<input type='text' name='addr3' value='90 Northward'>
<input type='text' name='addr4' value='apt 12 34 Marine way'>
<input type='text' name='addr5' value='2nd floor 900 Main St'>

on submit the form will post them to the next form.

second form
<%
while i < 5
response.write( "address " & i & " = " & request.form("a ddr" + i) &
chr(13))
i = i + 1
wend
%>

Is the syntax correct to get the values? I tried it but I dont get any values for the request.
If it is not the correct syntax, what should it be so I will be able
to see
it when the first form posts it to the second one?


This should do what you want:

<%
i = 1
while i < 5
frmStr = "addr" & i
Response.Write( "address " & i & " = " & Request.Form(fr mStr) & "<br>") i = i + 1
wend
%>
Note that another option might be to interate through the Form collection, but it will also include the submit button, and any other form inputs
<%:
For Each item in Request.Form
Response.Write( item & " = " & Request.Form(it em) & "<br>")
Next
%>

Regards,
Peter Foti


Jul 19 '05 #9
Got it. thanks for you reply.
Will
"Roland Hall" <nobody@nowhere > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
"wk6pack" wrote:
: I have a form with the following elements:
: first form
: <input type='text' name='addr1' value='1223 westward'>
: <input type='text' name='addr2' value='12 admirals rd'>
: <input type='text' name='addr3' value='90 Northward'>
: <input type='text' name='addr4' value='apt 12 34 Marine way'>
: <input type='text' name='addr5' value='2nd floor 900 Main St'>
:
: on submit the form will post them to the next form.
:
: second form
: <%
: while i < 5
: response.write( "address " & i & " = " & request.form("a ddr" + i) &
: chr(13))
: i = i + 1
: wend
: %>
:
: Is the syntax correct to get the values? I tried it but I dont get any
: values for the request.
: If it is not the correct syntax, what should it be so I will be able to
see
: it when the first form posts it to the second one?

Will, I assume when you say 'second form' you mean page. When you're
working with forms you should show all relevant code since <form ...> is
usually the area of interest.

This is a workable solution.

[first.asp]
----------
<%@ Language=VBScri pt %>
<%
Option Explicit
Response.Buffer = True
%>
<html>
<head>
<script type="text/javascript">
function validate() {
var a = new Array(4);
for(i=0; i<5; i++) {
a[i] = document.getEle mentById("addr" +(i+1))
if(!a[i].value) {
alert(a[i].id + " cannot be blank");
a[i].focus();
return false;
}
}
document.form1. action="/lab/next.asp";
document.form1. submit();
return true;
}
</script>
<body>
<form id="form1" name="form1" method="post" onSubmit="retur n validate()">
<input id="addr1" type='text' name='addr1' value='1223 westward' /><br />
<input id="addr2" type='text' name='addr2' value='12 admirals rd' /><br />
<input id="addr3" type='text' name='addr3' value='90 Northward' /><br />
<input id="addr4" type='text' name='addr4' value='apt 1234 Marine way' /><br />
<input id="addr5" type='text' name='addr5' value='2nd floor 900 Main St'
/><br />
<input id="submit1" type="submit" name="submit1" value="submit" />
<input id="reset1" type="reset" name="reset1" value="reset" /><br />
</form>
</body>
</html>

[next.asp]
----------
<%@ Language=VBScri pt %>
<%
Option Explicit
Response.Buffer = True
dim info(5)
dim i
for i = 1 to 5
info(i)=Request .Form("addr" & i)
Response.Write( "Address " & i & " = " & info(i) & "<br />" & vbCrLf)
next
%>

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

Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3741
by: forums_mp | last post by:
I've got an STL class (see below) with two functions to store and retrieve data - msg structs. The "Store" function when called will copy the received message (depending on which message) into the appropriate array. For instance if I receive a RCVD_MSG1, I'll copy into msg1 . Upon receipt of the next RCVD_MSG1. I'll copy into msg1 . The Retrieve function when called should retrieve the latest copy. ie. msg1 or msg1 .
1
7336
by: Bryan | last post by:
Hello: I need to retrieve the value of a textbox control in a asp.net datagrid using Javascript. Can anybody help out. I believe the control clientID needs to be passed client side so the javascript can reference. Any idea how. Thanks
5
2428
by: Dani | last post by:
Hello everybody, I have some code that disables form elements on body load, but I notice when I hit the "back" button, I need to re-enable the form elements (that is done by clicking on a radial button). Is there any way I can keep the form for disabling every time a user hits the back button and "remember" what elements should be enabled? I was thinking maybe utilizing some referrer thing, but I'm not that good with JS yet. Thanks...
0
1971
by: Pat Patterson | last post by:
I'm having serious issues with a page I'm developing. I just need some simple help, and was hoping someone might be able to help me out in here. I have a form, that consists of 3 pages of fields. I'd like to create a page in which all of this is stored as you move along as hidden variables, until the end, when the user submits. I can't figure out one thing: I have dynamic form elements (dropdowns), that I'd like to use instead of...
5
6666
by: bobdydd | last post by:
Hi Everybody I have an Access database that passes a Parameter to a web page something like this. http://localhost/index.htm?paramName=1234-54321 I want to be able to retrieve the parameter (In this example 1234-54321) and pass it to a text box on a form. Something like this. <form name="form1" id="form1" method="post" action="">
3
1989
by: Kees de Winter | last post by:
Hi, If I have a TextBox place inside a content placeholder then at runtime the TextBox's name changes to ctl00_ContentPlaceHolder1_tbCity. What is the best way to get the value of the TextBox server-side without 'guessing' the name in the produced HTML? Page.Request("??") Thanks --
6
3862
by: ashok.dhananjeyan | last post by:
Hi, Actually , I wrote one javascript to retrieve the name of the form in one particular page. what i did in this page is, <script> function checkbutton() {
13
3422
by: kev | last post by:
Hi all, I have created a database for equipments. I have a form to register the equipment meaning filling in all the particulars (ID, serial, type, location etc). I have two buttons at the end of the form which is submit and cancel. After i have clicked submit, the information is stored directly into my corresponding database table. My problem here is i need to retrieve back the information submitted to display all the data that the...
3
2646
by: David | last post by:
Hi, I have some code in my form as follows, to display 1 to 20 additional sets of fields to enter guest information. I am not sure how to retrieve these guests info so that I can post the info on an email such as: Additional Guest 1 First Name = Last Name =
0
8253
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6116
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.