If Request.Form("FORM_FIELD_1") = "Yes" AND Request.Form
("FORM_FIELD_2") = "" Then
Response.Redirect("FORM_ERROR_PAGE.asp")
End If
I have a situation now where I need to submit form data to one of two
pages based on field values.
Can I use this code to submit form data to one of two pages? I do not
know the proper code, but something like
If Request.Form("FORM_FIELD_1") = "Yes" AND Request.Form
("FORM_FIELD_2") = "" Then
SUBMIT_TO("FORM_PROCESS_PAGE.asp")
End If
Any sample code to solve my problem would be a huge help.
Thanks for your time.
> I currently use the following to redirect to an error page if a
> certain form field is not filled out.
>
> If Request.Form("FORM_FIELD_1") = "Yes" AND Request.Form
> ("FORM_FIELD_2") = "" Then
> Response.Redirect("FORM_ERROR_PAGE.asp")
> End If
>
> I have a situation now where I need to submit form data to one of two
> pages based on field values.
>
> Can I use this code to submit form data to one of two pages? I do not
> know the proper code, but something like
>
> If Request.Form("FORM_FIELD_1") = "Yes" AND Request.Form
> ("FORM_FIELD_2") = "" Then
> SUBMIT_TO("FORM_PROCESS_PAGE.asp")
> End If
You should be already on the submitting page
where you divert if your standard is not met:
============ FORM_PROCESS_PAGE.asp ==================
If Request.Form("FORM_FIELD_1") = "Yes" AND Request.Form
("FORM_FIELD_2") = "" Then
Response.Redirect("FORM_ERROR_PAGE.asp")
End If
--- Do here your form processing ----
======================================================
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Although I can redirect to the page, it does not pass thr form values
over. I need to basically "Submit" the form to a page that determines
based on a field value which page will "process" the form.
Example: If the form field value equals yes, then go to a page that
drops the data into a database.
If the form field equals no, thren go tp a page that
drops the data into an email.
I can move from page to page with no problem, but the form values ar
not comming with me on the redirect option.
It there something other than redirect that is used to "Submit" data
to a page?
> On Dec 3, 11:28�am, "Evertjan." <exjxw.hannivo...@interxnl.net> wrote:
>> Brave wrote on 03 dec 2009 in
>> microsoft.public.inetserver.asp.general:
>>
>>
>>
>>
>>
>> > I currently use the following to redirect to an error page if a
>> > certain form field is not filled out.
>>
>> > If Request.Form("FORM_FIELD_1") = "Yes" AND Request.Form
>> > ("FORM_FIELD_2") = "" Then
>> > Response.Redirect("FORM_ERROR_PAGE.asp")
>> > End If
>>
>> > I have a situation now where I need to submit form data to one of
>> > two pages based on field values.
>>
>> > Can I use this code to submit form data to one of two pages? I do
>> > not know the proper code, but something like
>>
>> > If Request.Form("FORM_FIELD_1") = "Yes" AND Request.Form
>> > ("FORM_FIELD_2") = "" Then
>> > SUBMIT_TO("FORM_PROCESS_PAGE.asp")
>> > End If
>>
>> You should be already on the submitting page
>> where you divert if your standard is not met:
>>
>> ============ FORM_PROCESS_PAGE.asp ====
> =============> If Request.Form("FORM_FIELD_1") = "Yes" AND
> Request.Form
>> � ("FORM_FIELD_2") = "" Then
>> � � �Response.Redirect("FORM_ERROR_PAGE.asp")
>> End If
>>
>> --- Do here your form processing ----
>>
>> ========================
> =============================>
[please do not quote signatures on usenet]
-
>>
>> - Show quoted text -
>
> Although I can redirect to the page, it does not pass thr form values
> over. I need to basically "Submit" the form to a page that determines
> based on a field value which page will "process" the form.
You do not need to redirect to the page, you just add your redirecting
code in the top of the form processing page.
> Example: If the form field value equals yes, then go to a page that
> drops the data into a database.
> If the form field equals no, thren go tp a page that
> drops the data into an email.
that's fine, but why would you neeed two pages,
ypu can do that all in one page.
============ FORM_PROCESS_PAGE.asp ====
If Request.Form("FORM_FIELD_1") = "Yes" AND Request.Form
� ("FORM_FIELD_2") = "" Then
� � �Response.Redirect("FORM_ERROR_PAGE.asp")
Elseif Request.Form("FORM_FIELD_1") = "Yes" Then
--- drop the data into a database ---
Else
--- drop the data into an email ---
End If
========================
> I can move from page to page with no problem, but the form values ar
> not comming with me on the redirect option.
No, of course you could make a clientside hidden[?] form containing the
data to be resubmitted, but there is no reason to give hackers this
extra possibility to hack.
What is wrong with doing it on the same page?
> It there something other than redirect that is used to "Submit" data
> to a page?
Submission is a clientside happening.
Redirection can only do querystring submission,
post/form submission is not possible in a redirect that way,
as you could deduce for your self.
so there are 3 [sensible] ways of using post submitted data on the
server:
1 use the request.form data on the same page
or
2 keep the data on the server in session variables for use on another
page
or
3 keep the data on the server in a database for use on another page
Ok, I'm not explaining it well so lets go this route.
I have a form that gathers some personal info such as name, email, and
street address.
The form has a field that is a radio button with the options of "Yes"
ot "No"
If they choose "Yes", I need to send the existing values to a new form
with 10 additional fields.
If they choose "No", I will need to send the existing values to a
completely different form with added fields that have nothing to do
with the version they use if they choose yes.
So what I need is a way to submit a form to a page that makes the
determination of which form we will be sendiong the data to based on
the Yes/No field.
Can this be done?
Yes:
a. you can use client-side code in the radio element's on_click event to
change the action attribute of the form element
b. In server-side code, you can use Server.Transfer to transfer the
request to a different page.
--
HTH,
Bob Barrows
Best,
Neil
As I told you, in my view it is better to use one page,
and make the additional values visible bij clientside scripting,
submitting all data in one go.
BUT,
if you want to do this in separate files, you can choose to keep the
primary data on the server in session variables.
OR
Populate the primary data in hidden input's on the client, like:
<input type='hidden' name='primary' value='<% = thePrimaryValue %>'>