|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to collect uncertain number of people information in a formHi everyone,
I need to write a insruance program which needs to collect multiple people information, The information for each person includes name, email, address, phone, dob etc. The DOB data will be used for calculate premium for each person. and then display total premium quote to the user I had never done that before and not sure, in asp technology what is the easiest way to do. Let's say the user want to enroll 30 people but I cannot display 30 grid on one asp page, and have to display 15 grid on the first page and then next 15 on the next page. What I should do in order to store all the information about the 30 people in the memory and insert into database at a once. Thank you -- Betty
Show quote
Hide quote
"c676228" <bettys@community.nospam> wrote in message Why not show a grid for as many people as needed?news:A5700E21-758B-45CB-9952-58EBB905DA79@microsoft.com... > Hi everyone, > > I need to write a insruance program which needs to collect multiple people > information, > The information for each person includes name, email, address, phone, dob etc. > The DOB data will be used for calculate premium for each person. and then > display total premium quote to the user > I had never done that before and not sure, in asp technology what is the > easiest way to do. > Let's say the user want to enroll 30 people but I cannot display 30 grid on > one asp page, and have to display 15 grid on the first page and then next 15 > on the next page. What I should do in order to store all the information > about the 30 people in the memory and insert into database at a once. > Thank you Will this get you started? Watch for word-wrap. It's 3 pages in one: first it asks how many rows you want; then it allows entry or that number of rows; then it displays what was entered in those rows. Just add field validation, database access, and a better UI. <%@ Language="VBScript" %> <% Option Explicit '* Const cASP = "census.asp" '* Dim intROW Dim strROW strROW = Request.Form("rows") Dim booTBL booTBL = True Dim strTBL strTBL = "" '* If Request.Form("show") = "True" Then Call Show() ElseIf IsNumeric(strROW) Then Call Rows() End If Sub Rows() For intROW = 1 To Cint(strROW) strTBL = strTBL & _ "<tr>" & _ " <td>" & intROW & ".</td>" & _ " <td><input type='text' name='nam" & intROW & "' size='20' maxlength='30' class='text'></td>" & _ " <td><input type='text' name='ema" & intROW & "' size='20' maxlength='50' class='text'></td>" & _ " <td><input type='text' name='add" & intROW & "' size='30' maxlength='50' class='text'></td>" & _ " <td><input type='text' name='tel" & intROW & "' size='15' maxlength='20' class='text'></td>" & _ " <td><input type='text' name='dob" & intROW & "' size='10' maxlength='10' class='text'></td>" & _ "</tr>" Next End Sub Sub Show() For intROW = 1 To Cint(strROW) Request.Form("") strTBL = strTBL & _ "<tr>" & _ " <td>" & intROW & ".</td>" & _ " <td>" & Request.Form("nam" & intROW) & "</td>" & _ "</tr>"" <td>" & Request.Form("ema" & intROW) & "</td>" & _ " <td>" & Request.Form("add" & intROW) & "</td>" & _ " <td>" & Request.Form("tel" & intROW) & "</td>" & _ " <td>" & Request.Form("dob" & intROW) & "</td>" & _ Next booTBL = False End Sub %> <html> <head> <title>census.htm</title> <style type="text/css"> body { font-family:Arial; font-size:9pt } td { font-family:Arial; font-size:8pt } th { font-family:Arial; font-size:8pt; font-weight:bold } ..text { font-family:Arial; font-size:8pt } </style> </head> <body> <center> <form action="<%=cASP%>" method="post"> <% If strTBL <> "" Then %> <h4>Enter Census Data</h4> <table border="0" cellpadding="0" cellspacing="2" width="700"> <tr> <th align="left">No.<hr></th> <th align="left">Name<hr></th> <th align="left">Amail<hr></th> <th align="left">Address<hr></th> <th align="left">Phone<hr></th> <th align="left">Birthdate<hr></th> </tr> <%=strTBL%> </table> <% If booTBL Then %> <input type="hidden" name="rows" value="<%=strROW%>"> <input type="hidden" name="show" value="True"><input type="submit" value="Submit"> <% End If %> <% Else %> <input type="hidden" name="show" value="False"> <input type="text" name="rows" size="2" maxlength="2" value="1"> <input type="submit" value="Submit"> <% End If %> </form> </center> </body> </html> Mckirahan,
That's the perfect start for me to think about it. Thank you so much. Allow me to ask you one more question, what does Request.Form("") serve for? Sincerely -- Show quoteHide quoteBetty "McKirahan" wrote: > "c676228" <bettys@community.nospam> wrote in message > news:A5700E21-758B-45CB-9952-58EBB905DA79@microsoft.com... > > Hi everyone, > > > > I need to write a insruance program which needs to collect multiple people > > information, > > The information for each person includes name, email, address, phone, dob > etc. > > The DOB data will be used for calculate premium for each person. and then > > display total premium quote to the user > > I had never done that before and not sure, in asp technology what is the > > easiest way to do. > > Let's say the user want to enroll 30 people but I cannot display 30 grid > on > > one asp page, and have to display 15 grid on the first page and then next > 15 > > on the next page. What I should do in order to store all the information > > about the 30 people in the memory and insert into database at a once. > > Thank you > > Why not show a grid for as many people as needed? > > Will this get you started? Watch for word-wrap. > > It's 3 pages in one: first it asks how many rows you want; > then it allows entry or that number of rows; then it displays > what was entered in those rows. > > Just add field validation, database access, and a better UI. > > > <%@ Language="VBScript" %> > <% Option Explicit > '* > Const cASP = "census.asp" > '* > Dim intROW > Dim strROW > strROW = Request.Form("rows") > Dim booTBL > booTBL = True > Dim strTBL > strTBL = "" > '* > If Request.Form("show") = "True" Then > Call Show() > ElseIf IsNumeric(strROW) Then > Call Rows() > End If > > Sub Rows() > For intROW = 1 To Cint(strROW) > strTBL = strTBL & _ > "<tr>" & _ > " <td>" & intROW & ".</td>" & _ > " <td><input type='text' name='nam" & intROW & "' size='20' > maxlength='30' class='text'></td>" & _ > " <td><input type='text' name='ema" & intROW & "' size='20' > maxlength='50' class='text'></td>" & _ > " <td><input type='text' name='add" & intROW & "' size='30' > maxlength='50' class='text'></td>" & _ > " <td><input type='text' name='tel" & intROW & "' size='15' > maxlength='20' class='text'></td>" & _ > " <td><input type='text' name='dob" & intROW & "' size='10' > maxlength='10' class='text'></td>" & _ > "</tr>" > Next > End Sub > > Sub Show() > For intROW = 1 To Cint(strROW) > Request.Form("") > strTBL = strTBL & _ > "<tr>" & _ > " <td>" & intROW & ".</td>" & _ > " <td>" & Request.Form("nam" & intROW) & "</td>" & _ > " <td>" & Request.Form("ema" & intROW) & "</td>" & _ > " <td>" & Request.Form("add" & intROW) & "</td>" & _ > " <td>" & Request.Form("tel" & intROW) & "</td>" & _ > " <td>" & Request.Form("dob" & intROW) & "</td>" & _ > "</tr>" > Next > booTBL = False > End Sub > %> > <html> > <head> > <title>census.htm</title> > <style type="text/css"> > body { font-family:Arial; font-size:9pt } > td { font-family:Arial; font-size:8pt } > th { font-family:Arial; font-size:8pt; font-weight:bold } > ..text { font-family:Arial; font-size:8pt } > </style> > </head> > <body> > <center> > <form action="<%=cASP%>" method="post"> > <% If strTBL <> "" Then %> > <h4>Enter Census Data</h4> > <table border="0" cellpadding="0" cellspacing="2" width="700"> > <tr> > <th align="left">No.<hr></th> > <th align="left">Name<hr></th> > <th align="left">Amail<hr></th> > <th align="left">Address<hr></th> > <th align="left">Phone<hr></th> > <th align="left">Birthdate<hr></th> > </tr> > <%=strTBL%> > </table> > <% If booTBL Then %> > <input type="hidden" name="rows" value="<%=strROW%>"> > <input type="hidden" name="show" value="True"> > <input type="submit" value="Submit"> > <% End If %> > <% Else %> > <input type="hidden" name="show" value="False"> > <input type="text" name="rows" size="2" maxlength="2" value="1"> > <input type="submit" value="Submit"> > <% End If %> > </form> > </center> > </body> > </html> > > > "c676228" <bettys@community.nospam> wrote in message Request.Form("") returns the contents of the form field namednews:3B2A071E-FC57-4CA4-AC19-35EA949C5AB6@microsoft.com... > Mckirahan, > That's the perfect start for me to think about it. Thank you so much. > Allow me to ask you one more question, > what does Request.Form("") serve for? within the parentheses when the form is posted. Thus, Request.Form("test_field") returns the contents of <input type="text" name="test_field" ...> The form field could be a text or password item, select option(s), checkbox, radiobutton, or textarea. For more information, visit these links: ASP Tutorial http://www.w3schools.com/asp/ ASP Request Object http://www.w3schools.com/asp/asp_ref_request.asp I will suggest you bind your datasource to a GridView Control.
This way, u can view any page by clicking on the page number, by the bottom of the gridview control. any updates made to the datasource is made once. If your data is comming from a middle Tier(a user defined class), you may choose ObjectDataSource as the datasource and bind it to the gridview. -- Show quoteHide quoteOkoronkwo Chinedu MCAD "c676228" wrote: > Mckirahan, > That's the perfect start for me to think about it. Thank you so much. > Allow me to ask you one more question, what does Request.Form("") serve for? > Sincerely > -- > Betty > > > "McKirahan" wrote: > > > "c676228" <bettys@community.nospam> wrote in message > > news:A5700E21-758B-45CB-9952-58EBB905DA79@microsoft.com... > > > Hi everyone, > > > > > > I need to write a insruance program which needs to collect multiple people > > > information, > > > The information for each person includes name, email, address, phone, dob > > etc. > > > The DOB data will be used for calculate premium for each person. and then > > > display total premium quote to the user > > > I had never done that before and not sure, in asp technology what is the > > > easiest way to do. > > > Let's say the user want to enroll 30 people but I cannot display 30 grid > > on > > > one asp page, and have to display 15 grid on the first page and then next > > 15 > > > on the next page. What I should do in order to store all the information > > > about the 30 people in the memory and insert into database at a once. > > > Thank you > > > > Why not show a grid for as many people as needed? > > > > Will this get you started? Watch for word-wrap. > > > > It's 3 pages in one: first it asks how many rows you want; > > then it allows entry or that number of rows; then it displays > > what was entered in those rows. > > > > Just add field validation, database access, and a better UI. > > > > > > <%@ Language="VBScript" %> > > <% Option Explicit > > '* > > Const cASP = "census.asp" > > '* > > Dim intROW > > Dim strROW > > strROW = Request.Form("rows") > > Dim booTBL > > booTBL = True > > Dim strTBL > > strTBL = "" > > '* > > If Request.Form("show") = "True" Then > > Call Show() > > ElseIf IsNumeric(strROW) Then > > Call Rows() > > End If > > > > Sub Rows() > > For intROW = 1 To Cint(strROW) > > strTBL = strTBL & _ > > "<tr>" & _ > > " <td>" & intROW & ".</td>" & _ > > " <td><input type='text' name='nam" & intROW & "' size='20' > > maxlength='30' class='text'></td>" & _ > > " <td><input type='text' name='ema" & intROW & "' size='20' > > maxlength='50' class='text'></td>" & _ > > " <td><input type='text' name='add" & intROW & "' size='30' > > maxlength='50' class='text'></td>" & _ > > " <td><input type='text' name='tel" & intROW & "' size='15' > > maxlength='20' class='text'></td>" & _ > > " <td><input type='text' name='dob" & intROW & "' size='10' > > maxlength='10' class='text'></td>" & _ > > "</tr>" > > Next > > End Sub > > > > Sub Show() > > For intROW = 1 To Cint(strROW) > > Request.Form("") > > strTBL = strTBL & _ > > "<tr>" & _ > > " <td>" & intROW & ".</td>" & _ > > " <td>" & Request.Form("nam" & intROW) & "</td>" & _ > > " <td>" & Request.Form("ema" & intROW) & "</td>" & _ > > " <td>" & Request.Form("add" & intROW) & "</td>" & _ > > " <td>" & Request.Form("tel" & intROW) & "</td>" & _ > > " <td>" & Request.Form("dob" & intROW) & "</td>" & _ > > "</tr>" > > Next > > booTBL = False > > End Sub > > %> > > <html> > > <head> > > <title>census.htm</title> > > <style type="text/css"> > > body { font-family:Arial; font-size:9pt } > > td { font-family:Arial; font-size:8pt } > > th { font-family:Arial; font-size:8pt; font-weight:bold } > > ..text { font-family:Arial; font-size:8pt } > > </style> > > </head> > > <body> > > <center> > > <form action="<%=cASP%>" method="post"> > > <% If strTBL <> "" Then %> > > <h4>Enter Census Data</h4> > > <table border="0" cellpadding="0" cellspacing="2" width="700"> > > <tr> > > <th align="left">No.<hr></th> > > <th align="left">Name<hr></th> > > <th align="left">Amail<hr></th> > > <th align="left">Address<hr></th> > > <th align="left">Phone<hr></th> > > <th align="left">Birthdate<hr></th> > > </tr> > > <%=strTBL%> > > </table> > > <% If booTBL Then %> > > <input type="hidden" name="rows" value="<%=strROW%>"> > > <input type="hidden" name="show" value="True"> > > <input type="submit" value="Submit"> > > <% End If %> > > <% Else %> > > <input type="hidden" name="show" value="False"> > > <input type="text" name="rows" size="2" maxlength="2" value="1"> > > <input type="submit" value="Submit"> > > <% End If %> > > </form> > > </center> > > </body> > > </html> > > > > > >
Other interesting topics
How do I make sure that a asp page expires immediately and is not stored in the history ???
need bullet proof input validator How expensive is object instantication? 3-factor login system Restrict access by ip -2147217900:Syntax error in INSERT INTO statement. Split, convert date question ?? Random GUID type number or RegExp Jet Database Error Unable to connect to SQL Server database. |
|||||||||||||||||||||||