Solved

Redirect Form variables

Posted on 2006-11-09
4
158 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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