?
Solved

Redirect Form variables

Posted on 2006-11-09
4
Medium Priority
?
171 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 2000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

801 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