ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 24th, 2003, 09:21 AM
rosenzl rosenzl is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 12 rosenzl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ASP - Attempting to preserve input fields

I have a .asp form page that submits to another .asp page that uses cdonts to send me an email and does a response.redirect back to the form page. I need to preserve (keep) a couple of text box values and a couple of dropdown box values. At this point I have global.asa variables for the fields in question and they are all set to null. I can't figure out how to put the contents back in the fields, when it returns from the cdonts page. I assume that I must save all the field values in the session variables just prior to the submit to the cdonts page.

If you can show me how to accomplich this for one text field called name and one dropdown box called PUDeliv (one option for pickup and one for delivery), it would be greatly appreciated.

To get a better picture, go to www.faxfoodorder.com/newpage2.asp - This page submits to /get.asp which retrieves all the form fields and sends an email using cdonts and then redirects back to newpage2.asp.

Larry

P.S. I use outlook, IE 6.0

Reply With Quote
  #2  
Old February 24th, 2003, 12:44 PM
jholmes jholmes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 15 jholmes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i do the same thing with my forms, where when it redirects back to the form but maintains the values. first i used a querystring; this worked fine, until i started using textareas, which allowed for multiple lines of input. so now i use forms. whatever section the code enters, i have it write out a form with hidden input elements set to the values of the form. then the form submits itself in javascript code when the page loads. on the form end, then, i retrieve the variables. for text fields, it's as simple as putting the variables straight into the inputs, but to have drop down boxes select the appropriate option, it gets tricky. here's what i did for that:

//This function writes "selected" for the matching term when the
//user has entered invalid info, and is redirected back to the form
//to fill in appropriate information
//num is any one of the following
//1 = gender, 2 = birthmonth, 3 = birthday, 4 = state
//option is the value of the option that's being written
function select(num, option) {
var category;
if (num == 1) { category = gender; }
else if (num == 2) { category = birthmonth; }
else if (num == 3) { category = birthday; }
else if (num == 4) { category = state; }
option = new String(option);
category = new String(category);
if(option.valueOf() == category.valueOf()) {
Response.Write(" selected");
}
}


then an example of when the page writes the select input:

<select class="formselect" name="gender">
<option<%select(1, "");%>></option>
<option<%select(1, "Male");%>>Male</option>
<option<%select(1, "Female");%>>Female</option>
</select>

that's my solution anyway... if you want to use session variables to store form info, i'd think that would work , too:

Session("name") = name
Session("PUDeliv") = PUDeliv

you'll still have to do the function call for PUDeliv's select input

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > ASP - Attempting to preserve input fields

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap