 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 1st, 2005, 10:52 PM
|
|
Authorized User
|
|
Join Date: May 2005
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
form data in multiple pages
Hi,
I have a two part question/problem:
First, I need a good way of passing a userid across a multipage survey - this field is entered on the main page. With this userid - i need to be able to update rs data on subsequent pages - this is a multipage survey
This brings up a questions - onsubmit the userid is inserted into a tbl and the user is directed to the first page of the survey, now that we have one field in the tbl - should I be updating or inserting data (all based on the userid)
second questions - how do I get one form field to enter into two separate databases at the same time?
- I am using asp and dreamweaver mx with a dns to access.
Thank you for your time and assistance!
Chris
|
|

May 2nd, 2005, 12:12 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
If you submit a form, you can pass the user ID in the form or QueryString. Something like this will work:
<form method="post" action="Page2.asp">
<input type="hidden" name="txtUserName" value="<%=Request.Form("txtUserName")%>" />
</form>
If you add the same code in Page2, Page3 etc the value will be persisted.
In multi page forms you basically have two options:
1. Collect all information in the form and submit it from page to page. In the final page, insert all of it in the database.
2. Insert the data fro each page in the database right away. This means that after you submitted page 1, you need to store the ID of the record in the database and pass it to the next page.
Page 2 can then use this ID to *update* the existing record, appending the data from the second page. You can repeat this process for each of your pages.
Not sure what you mean with your final question. Isn't that as simple as executing the same Sql statement twice, each time against a different database connection?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Brother, My Cup Is Empty by Nick Cave & the Bad Seeds (Track 4 from the album: Henry's Dream) What's This?
|
|

May 2nd, 2005, 02:22 PM
|
|
Authorized User
|
|
Join Date: May 2005
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It seems so simple - yet I can't get Dreamweaver to do it:
I insert a record on the first page (the userID)
Then I want to Update on the subsequent pages - using the recordset associated with the userID.
In Dreamweaver, the first page gives me this:
<input type="hidden" name="MM_insert" value="aaaai_survey">
When I set up the rs on th esecond page and update I get this:
<input type="hidden" name="MM_recordId" value="<%= rsdemos.Fields.Item("ID").Value %>">
If I try to manually change these fields it completely dies.
I have checked the database - it receives my user ID - but it will not append any data to it.
I am a novice with ASP - but on a deadline.
update:
Here is my error - I know it means that it can't find a record..
ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/survey_pages/survey_1.asp, line 371
but I can't figure out how to tell it where to look.
line 371: <input type="hidden" name="MM_recordId" value="<%= rsdemos.Fields.Item("ID").Value %>">
|
|

May 3rd, 2005, 03:04 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
It's not that simple, and especially not with Dreamweaver.
DW is good at creating INSERT / UPDATE forms that allow you to either Insert or Update data on a single form. Multi-page forms are always a bit tricky, and especially with the verbose code DW tends to create for insert / update forms.
If I were you, I'd try to create your own data access code for the inserts and updates. Probably faster to create and much easier to maintain.
Just pass along the unique id of the new record from page 2 to page 3 and so on so you know what record to update.....
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Tony's Theme by Pixies (Track 9 from the album: Surfer Rosa & Come On Pilgrim) What's This?
|
|

May 13th, 2005, 01:12 PM
|
|
Authorized User
|
|
Join Date: May 2005
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
Thanks for your help earlier - I did manage to get dreamweaver to do what I wanted by using cookies to carry the id accross the multiple pages. I also made all the form inputs dynamic - set the cursor to keyset with alocktype of pessimistic.
I have an additional problem, and this may not be the place to post but..
based on the userid I would like to route users to one of two databases,
I originally thought I could have apage after the login page that had an if/then statement to the effect of if request.cookie (ID) begins with a 1 or 2 or 3 then response.redirect db1.asp
I am not a great programmer (massive understatement) but would anyone know how to write a little vbscript ot javascript that could do this?
Thanks,
Chris
|
|

May 14th, 2005, 02:07 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
What's wrong with your initial proposed solution? IMO, that's the best place to do such a thing. On the Login page you have all the details about the user available, so you can easily redirect to the right page based based on the user's info.
Are you having troubles writing the ASP script, or are you not sure how to design such a thing?
But why are you redirecting to different pages? You may have very good reasons to do so, but a solution like this often means maintaining three almost identical pages. This means three locations for possible bugs as well.
Isn't is possible to have a generic page that behaves differently based on the user that logged in?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

May 14th, 2005, 01:16 PM
|
|
Authorized User
|
|
Join Date: May 2005
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
The main reason for redirecting is that I don't want my survey to crash. I have two identical sites up and running - with an access database as the backend(I have to work with what is given me) The people taking the survey will be sent an email link that directs them to the site (I don't have any control of that as well) there are 5000 people that will be receiving the email - what I don't want to happen is the access database to crash because of too many concurrent connections. Additionally, I have not been given any info about the people other than they will be using a member id that they know (the people who I am helping do this did not want any user authentification) I don't even have any specific about the user id, not even how many numbers it is. Anyway, The point is I don't know how to write the code to redirect someone based on what number their id starts or ends with. Sorry for such a long answer - the site actually goes live tomorrow night - it is up and running well - I am just a little worried about concurrent connections. I have done alot to streamline the process - I always close my connections and only open during the actual update - it has tested well - but I haven't tried to hit it with a couple hundred people at once though.
Thanks for your help and for letting vent a little frustration!
Chris
|
|

May 14th, 2005, 02:26 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
5000 users... Wow. Hopefully, they are not all going to take the survey at the same time, or your system will come down.
You can use Left or Right to determine where to redirect:
If Left(Request.Cookies("UserId"), 5) = "12345 Then
Response.Redirect("SomePage.aspx")
Else
Response.Redirect("SomeOtherPage.aspx")
End If
or
If Right(Request.Cookies("UserId"), 5) = "12345 Then
Response.Redirect("SomePage.aspx")
Else
Response.Redirect("SomeOtherPage.aspx")
End If
In the first code block, the If will fire when the user id starts with 12345. The second code block checks if the id ends with 12345
Hope this helps, although it's probably too later....
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

May 14th, 2005, 08:25 PM
|
|
Authorized User
|
|
Join Date: May 2005
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks a bunch Imar!
I probably have just enough time to get this up and running and test it.
I will let you know how the survey hold up! Next one will be done with php and mysql!
Chris
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Multiple pages |
usedcarsgbcom |
Beginning PHP |
1 |
November 24th, 2004 12:31 PM |
| Form authentication & multiple login pages |
duydp |
ASP.NET 1.0 and 1.1 Professional |
2 |
September 14th, 2004 12:18 PM |
| Multiple pages |
draganmit |
BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 |
2 |
May 23rd, 2004 12:12 PM |
| Multiple pages |
draganmit |
VB.NET 2002/2003 Basics |
0 |
April 18th, 2004 09:28 AM |
|
 |