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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I retain my field values in my Form

Status
Not open for further replies.

axsom1

Technical User
Feb 27, 2001
67
US
I have a form that uses alot of dropdown boxes for users to select, now say Mary Jane has an allergy that isnt on the table, Ive given the data entry person the ability from within the form to directly add an allergy in this case to the database but of course has to refresh the screen to see that new allergy. Proble is if there is any way to keep all the information the person has entered. I looked into cookies but since the form isnt being submitted yet theres no collection taking place. I would love to break the form up in two parts, demographics and patient history but thats not an option. Thanks

John
 
I see two ways of solving this.
Either you add the new allergy to the dropdown with a client side javascript or you can actually form post and read all the previously entered data and write them out to the page again but not writing them to the database just yet. The new allergy you will have to add to the database though.
You check the new allergy field to see if you just should add a allergy and not write the other data to the database.

Check out "Amending Options" for how to add options with client side javascript NS4+, IE4+
If you go for the client side solution you will also have to deal with two or more concurrent users adding allergys in their browsers.
 
when you add the allergy is it to sql on this page or another page?

USING GET
In any case you need to trap the values of the text boxes into variables forming your querystring (using "get"), then write them back out to these controls when the page reloads.

USING POST
If your'e using "post" then simply use request.Form("text1") in your variable assignments on the page your'e posting to. then pass the values back in your redirection,
to the original page-then write the values back to the text controls..

These are the 2 most common ways of maintaining state in web apps..
 
How to retain 'em when the user presses the back button and reaches the prev. page?
Thank you...
RR

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top