Solved

Redirect Form variables

Posted on 2006-11-09
4
160 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

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…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

763 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