Solved

Redirect Form variables

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Asp.net Hosting Plan security, reliable, stable 1 84
IPA - can it be run on a web server? 3 247
ColdFusion Rereplace 3 96
JVM encoding. How to change encoding. 27 128
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

732 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