If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

preserving input fields on a form

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 on the form, 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, but then what?

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 /get3.asp which retrieves all the form fields and sends an email using cdonts and then redirects back to newpage2.asp.

I grad all of the input request variable value and past them on to succeeding pages. I do this like:

dim savReq
savReq=Request.form

One way to pass these on is:

<form ...... Action="xxx.asp?<%=savReq%> .....>

Another would be to save the values ("request.form") in a session variable.

Then you may have to do some ASP coding to reload the variable values into the form, depending on how you loaded them initially. If you just start out with an empty form (not DB fed) then the textboxes will not be a problem You might have to "force" values into the dropdown boxes though.

Ex. of textbox:

<input type="text" name="xxx" value="<%=request("fieldname")%>" >

First time it will be empty; on reentry it will have the previous value.

Hi Larry, thanks for your response. I have no problem passing the fields to the send email page and the send email does send me a valid email with all the form fields on it. I have tried doing the following which is similar to what you suggested:

First, there is really no reason that I can see for you to define the Session variable in global.asa. Just use it when you need to. Then set it to an empty string.

As far as the email page is concerned, if you just pass the request variables as I showed you, you should be able to examine their values on the target page just as if they were controls on the previous page. I have exactly the same situation as you have, and I don't have any problems with interrogating the request values.

hi,
Ok to start with, don't abuse session variables for storing values to be passed to another page. What you are trying to do would be a lot easier if you post your form back to itself and have the form and the CDONTS in the same page.

name, email address, phone, pickup/delivery (dropdown box), times for pickup or delivery (dropdown box), address and company name are thew fields that I need to redisplay, after submitting to send email page.

This is correct. If you click the refresh basically your telling the browers to redisplay the page the way it was when you first requested it. As the page is ASP then to do this it has to resend the information back to the server.

How can I make it so it refreshes or does nothing when I click on refresh?

You can't with ASP. Not sure if you can use Javascript to disable the refresh btton, but this is not recommended.

I also call the validate routine to hold values just prior to a submit to the same page as follows:

<%

validate = request.form("validate")

if validate = "yes" then

UserName = request.form("UserName")

emailaddress = request.form("emailaddress")

pudeliv = request.form("pudeliv")

phone = request.form("phone")

addressdeliv = request.form("addressdeliv")

coname = request.form("coname")

then I use cdonts to email me the form……

end if

%>

All works fine except that when my page links to itself and returns, the pudeliv dropdown field returns to -choose one- regardless of which item I select. The email I get is fine with the proper selection.

1. Do I need to save the pudeliv field? If so, am I doing it correctly above?

2. What else do I need to do keep the value I selected when I come back from the link to myself?

hi,
i am not sure which order you have your select box and your validation script but i will persume it is in the same order as what you have posted. If this is the case then you need to request the value of the select box before you try use the value in your if statment in your options. Bellow is an example:

What you need is the request.form stuff and validation at the top of your page then your form. This way if the page is being displayed for the first time the validation part will be skipped and only display the form with the initial state for text and select boxes etc. On submit the page starts again this time it will do the validate, set values to variables for all your form elements then display the form again, but this time you have all your values to work with. You can now use them to set the submitted values on your form.