Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Help with passing form field values. (http://www.velocityreviews.com/forums/t804991-help-with-passing-form-field-values.html)

Brave 12-03-2009 03:41 PM

Help with passing form field values.
 
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


Any sample code to solve my problem would be a huge help.

Thanks for your time.


Evertjan. 12-03-2009 04:28 PM

Re: Help with passing form field values.
 
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 ----

================================================== ====



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Brave 12-03-2009 05:16 PM

Re: Help with passing form field values.
 
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 ----
>
> ================================================== ====
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)- Hide quoted text -
>
> - 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.

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?

Evertjan. 12-03-2009 05:37 PM

Re: Help with passing form field values.
 
Brave wrote on 03 dec 2009 in microsoft.public.inetserver.asp.general:

> 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


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Brave 12-03-2009 05:57 PM

Re: Help with passing form field values.
 
On Dec 3, 12:37*pm, "Evertjan." <exjxw.hannivo...@interxnl.net> wrote:
> Brave wrote on 03 dec 2009 in microsoft.public.inetserver.asp.general:
>
>
>
>
>
> > 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
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)- Hide quoted text -
>
> - Show quoted text -


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?

Bob Barrows 12-03-2009 06:09 PM

Re: Help with passing form field values.
 
Brave wrote:
>
> 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



Neil Gould 12-03-2009 06:52 PM

Re: Help with passing form field values.
 
Brave wrote:
> On Dec 3, 12:37 pm, "Evertjan." <exjxw.hannivo...@interxnl.net> wrote:
>> Brave wrote on 03 dec 2009 in
>> microsoft.public.inetserver.asp.general:
>>
>>
>>
>>
>>
>>> 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
>>
>> --
>> Evertjan.
>> The Netherlands.
>> (Please change the x'es to dots in my emailaddress)- Hide quoted
>> text -
>>
>> - Show quoted text -

>
> 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?
>

When I need to do this kind of thing, I use session variables to store the
collected data. For example, if each of 3 forms have 10 fields, 30 session
variables would be needed. One advantage to this approach is that, should
there be a need for the user to make corrections, previous form pages can be
populated with the session variable information and a summary of the
submissions is also easy to accomplish.

Best,

Neil





Evertjan. 12-03-2009 07:35 PM

Re: Help with passing form field values.
 
Brave wrote on 03 dec 2009 in microsoft.public.inetserver.asp.general:

> 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?
>


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 %>'>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


All times are GMT. The time now is 01:40 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.