Solved

Redirect Form variables

Posted on 2006-11-09
4
156 Views
Last Modified: 2013-12-24
Experts,

I need help automatically redirecting form variables from a validation page to a processing page. This is what I have going: I have a product page where a user can select a product and its options to purchase. Once he submits the form, it will go to a validation page on my site where inventory is checked against the quantity submitted in the form. If the quantity submitted is more than the quantity in inventory (in the database) an error is thrown stopping the form process. If validation is ok, the form then automatically submits itself from the validation  page with all form variables to another website for processing.

I've tried using CFHTTP with no luck. Please really need your help!

Thanks

rr
0
Comment
Question by:rruth
4 Comments
 
LVL 13

Accepted Solution

by:
usachrisk1983 earned 500 total points
ID: 17913487
I'll show you how this is done with just one form variable:

Product Page:
<cfinput type="text" name="product_id" value="50">
<!--- The rest of your form --->

Validation Page:
<cfparam name="form.product_id" default="">
<!--- A CFPARAM for each of your form vars --->
<!--- All your processing and checking is done --->
<cfform name="frmSubmitOrder" action="your_processing_page.cfm" method="post">
  <cfinput type="hidden" name="product_id" value="#form.product_id#">
</cfform>
<script language="javascript">frmSubmitOrder.submit();</script>

Production Page:
<!--- You now have a form.product_id with the original value --->

But... you could save yourself some trouble if you did all your validation on top of your production page.
0
 
LVL 7

Expert Comment

by:ExpertAdmin
ID: 17914215
You may want to consider using an include for your validations. This will allow you to maintain one set of validation code and call it from multiple page headers:

<cfinclude template="validate.cfm">

Note that your include will be added into your page "inline" as it is processed, so you don't need any HTML HEAD or BODY elements. Just the validation code.

Doing this (or doing as usachrisk1983 suggested and just validating in the page that processes the order) would eliminate the need to redirect unless there was an error detected, at which point you could use <cflocation> to redirect them back to the calling page.

M@
0
 
LVL 10

Expert Comment

by:rob_lorentz
ID: 17915885
I would like to second the idea of using and include file for your validations.

<cfset form.eMsg = "">
<cfinclude template="inc_formValidations.cfm">
<cfif not len(form.eMsg)>
    <cfinclude template="inc_formProcessing.cfm">
</cfif>

lookup FuseBox.






0
 

Author Comment

by:rruth
ID: 17919546
usachrisk1983, Your solution will work for me - Thank you!

ExpertAdmin, Thank you for you suggestion but I will use the code in a "cfc" instead of an include.
                         
rob_lorentz, Again I plan on using a "cfc" for the validation. I have no control over the processing page due to the fact that it is on another website out of my control.

Thank you all for your suggestions.

rr                                        
     
0

Featured Post

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Join & Write a Comment

Suggested Solutions

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now