Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

request.form headache

Status
Not open for further replies.

superdog4492

Programmer
Nov 14, 2002
12
CA
Hi!
I'm working on an online questionnaire (ASP with SQL Server db). I fear i've painted myself in to a corner....

I'd like to let the user return to a question that they've already submitted to the request.form object, and provide a new answer that replaces the old one. If I just submit a second value, the two values become a comma-delimited list. Ideally, I'd like the second value to replace the first. Is there any way to make that happen? Can the request.form object be manipulated programmatically, or only through a form element's submission?

Any help would be greatly appreciated...thanks!
superdog

 
I'm sure that there is a solution to what you're trying to do. I'm just not quite sure what you're doing...

When a person completes a form, they submit it.

The form handler page posts the data to the DB and displays it back to the user for updates?

Then you simply UPDATE the record. I must be off somewhere. Please elaborate...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Hi mwolff00!

Sorry, I should have been more explicit. After form1 is submitted, the value is added to request.form and the user goes on to form2. Values are updated to the database only when all forms (form1, form2, etc) are complete.

I'd like the user to be able to return to form1, enter a new value, and have this new value replace the old one they submitted earlier.

(I guess one solution is to update to the db after each form is submitted, but that would require some serious work at this point -- that's the corner I'm painted in to!)

Any thoughts?
superdog
 
You're going to have to do that anyways. You can only handle one form at a time. So, when form1 is submitted, you can add the data to a database (easy) or store it in hidden fields in form2 (harder).

You say "the value is added to request.form and the user goes to form2". Once the server returns control to the client-side (ie - sends out form2), the request.form object is empty...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Ahhh I see. I'm storing the values from form1 as hidden values in form2. That's how they're ending up back in form1 when the user returns, and getting in the way of a second submission. So I guess I'll have to update to the database on each form. It seemed like a harmless decision at the beginning, and look where it got me! What a clown! :eek:)

Thanks for helping me work this through!
superdog
 
Well, not exactly...

You do need to handle one form at a time. But the values being in form1 when you return are from the browser caching them. The hidden form fields I was talking about would have to be written and loaded by you and the original form values would have to be reloaded using code that you wrote (which doesn't seem to be the case...)

Simple answer - handle one form at a time.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top