473,842 Members | 1,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP: Multiple page forms, with dynamic form elements - HELP!

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 setting the dropdowns statically.

Here's the dynamic select I'd like to use - can someone help me out? I
can't just add them into the code - I keep getting an error message as
soon as I do it, but I'm not sure why. Novice ASP developer here. :(
Again, all I want to do is replace the <select> from the ASP page
underneath with my dynamic <select>...
<select name="settingOf fered" id="settingOffe red">
<%
While (NOT rssettingOffere d.EOF)
%>
<option
value="<%=(rsse ttingOffered.Fi elds.Item("pkSe ttingOffered"). Value)%>">
<%=(rssettingOf fered.Fields.It em("settingOffe red").Value)%> </option>
<%
rssettingOffere d.MoveNext()
Wend
If (rssettingOffer ed.CursorType > 0) Then
rssettingOffere d.MoveFirst
Else
rssettingOffere d.Requery
End If
%>
</select>

*************** *************** *************** *

And here's the page that I can't get to work:

*************** *************** *************** *

<%
Const NUMBER_OF_PAGES = 3

Dim intPreviousPage
Dim intCurrentPage
Dim strItem

intPreviousPage = Request.Form("p age")

Select Case Request.Form("n avigate")
Case "< Back"
intCurrentPage = intPreviousPage - 1
Case "Next >"
intCurrentPage = intPreviousPage + 1
Case Else
intCurrentPage = 1
End Select

If Request.Form("n avigate") <> "Finish" Then %>
<form action="<%= Request.ServerV ariables("URL") %>" method="post">
<input type="hidden" name="page" value="<%= intCurrentPage %>">

<%
For Each strItem In Request.Form

If strItem <> "page" And strItem <> "navigate" Then
If CInt(Left(strIt em, 1)) <> intCurrentPage Then
Response.Write( "<input type=""hidden"" name=""" & strItem & """" _
& " value=""" & Request.Form(st rItem) & """>" & vbCrLf)
End If
End If
Next

Select Case intCurrentPage

<%
Case 1
%>
<table>
<tr>
<td><strong>Age :</strong></td>
<td>
<select name="3_age">
<option></option>
<option<% If Request.Form("3 _age") = "< 20" Then Response.Write( "
selected=""sele cted""") %>>&lt; 20</option>
<option<% If Request.Form("3 _age") = "20 - 29" Then Response.Write( "
selected=""sele cted""") %>>20 - 29</option>
</select>
</td>
</tr>
</table>

<%
Case 2
%>
<table>
<tr>
<td><strong>Age :</strong></td>
<td>
<select name="3_age">
<option></option>
<option<% If Request.Form("3 _age") = "< 20" Then Response.Write( "
selected=""sele cted""") %>>&lt; 20</option>
<option<% If Request.Form("3 _age") = "20 - 29" Then Response.Write( "
selected=""sele cted""") %>>20 - 29</option>
</select>
</td>
</tr>
</table>

<%
Case 3
%>
<table>
<tr>
<td><strong>Age :</strong></td>
<td>
<select name="3_age">
<option></option>
<option<% If Request.Form("3 _age") = "< 20" Then Response.Write( "
selected=""sele cted""") %>>&lt; 20</option>
<option<% If Request.Form("3 _age") = "20 - 29" Then Response.Write( "
selected=""sele cted""") %>>20 - 29</option>
</select>
</td>
</tr>
</table>
<%
Case Else
Response.Write( "Error: Bad Page Number!")
End Select
%>
<br />

<% If intCurrentPage > 1 Then %>
<input type="submit" name="navigate" value="&lt; Back">
<% End If %>
<% If intCurrentPage < NUMBER_OF_PAGES Then %>
<input type="submit" name="navigate" value="Next &gt;">
<% Else %>
<input type="submit" name="navigate" value="Finish">
<% End If %>
</form>
<%
Else
For Each strItem In Request.Form
Response.Write( strItem & ": " & Request.Form(st rItem) & "<br />" &
vbCrLf)
Next
%>

<p><strong>
Here's what you entered:
</strong></p>

<pre>
<strong>Name: </strong> <%= Request.Form("1 _name") %>
<strong>Email :</strong> <%= Request.Form("1 _email") %>
<strong>Address :</strong> <%= Request.Form("2 _address") %>
<strong>City: </strong> <%= Request.Form("2 _city") %>
<strong>State :</strong> <%= Request.Form("2 _state") %>
<strong>Zip:</strong> <%= Request.Form("2 _zip") %>
<strong>Sex:</strong> <%= Request.Form("3 _sex") %>
<strong>Age:</strong> <%= Request.Form("3 _age") %>
</pre>

<p>
<a href="<%= Request.ServerV ariables("URL") %>">Start Again</a>
</p>

<%
End If
%>

Oct 21 '05 #1
0 1983

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

Similar topics

4
7271
by: jedimasta | last post by:
Good evening all, I'm a relatively new to javascript, but I've been working with ColdFusion and PHP for years so I'm not necessarily ignorant, just stuck and frustrated. Using ColdFusion I'm using an include to pull in form elements (text fields, checkboxes, etc...) multiple times on a single page. The included page does not have a form tag of it's own, but the root page has uniquely named forms for validation. Imagine it like this:
5
14137
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
0
3673
by: shamirza | last post by:
· When was .NET announced? Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET. · When was the first version of .NET released? The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on...
0
3849
by: shamirza | last post by:
· What is view state and use of it? The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested for the first time versus when the form is posted (sent to the server), which allows you to program accordingly. · What are user controls and custom controls? Custom controls: A control authored by a user or a third-party software vendor that...
0
9717
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10617
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
10681
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
9459
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
7862
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
7045
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();...
0
5886
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4506
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
3
3148
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.