472,374 Members | 1,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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="settingOffered" id="settingOffered">
<%
While (NOT rssettingOffered.EOF)
%>
<option
value="<%=(rssettingOffered.Fields.Item("pkSetting Offered").Value)%>">
<%=(rssettingOffered.Fields.Item("settingOffered") .Value)%></option>
<%
rssettingOffered.MoveNext()
Wend
If (rssettingOffered.CursorType > 0) Then
rssettingOffered.MoveFirst
Else
rssettingOffered.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("page")

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

If Request.Form("navigate") <> "Finish" Then %>
<form action="<%= Request.ServerVariables("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(strItem, 1)) <> intCurrentPage Then
Response.Write("<input type=""hidden"" name=""" & strItem & """" _
& " value=""" & Request.Form(strItem) & """>" & 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=""selected""") %>>&lt; 20</option>
<option<% If Request.Form("3_age") = "20 - 29" Then Response.Write("
selected=""selected""") %>>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=""selected""") %>>&lt; 20</option>
<option<% If Request.Form("3_age") = "20 - 29" Then Response.Write("
selected=""selected""") %>>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=""selected""") %>>&lt; 20</option>
<option<% If Request.Form("3_age") = "20 - 29" Then Response.Write("
selected=""selected""") %>>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(strItem) & "<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.ServerVariables("URL") %>">Start Again</a>
</p>

<%
End If
%>

Oct 21 '05 #1
0 1891

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

Similar topics

4
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...
5
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
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...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.