Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing Form Vars To Final Page

Posted on 2011-09-10
6
Medium Priority
?
233 Views
Last Modified: 2012-05-12
I'm not sure if the problem is in my Application.cfm or what but there's not too much to it because I'm really not hosting a ColdFusion site in this case- only using my CF server for a single form/mailer/database entry. The best way to see whats happening is to go to apelectricservices.com and use the "Text-A-Tek" form on the right. You will see that the only the 1st entry, Name:, is being displayed as the results on the final, thanks.cfm. This is also the only variable being inserted into the database.... It use to work. Maybe my code is so brilliant that it grew it's own personality and decidsed to change itself? Far from it LOL. I know just enough to get into trouble.
App.cfm
<cfapplication name="MyApp"  clientmanagement="No"
                    sessionmanagement="Yes"
                    sessiontimeout="#CreateTimeSpan(0,0,15,0)#"
                    applicationtimeout="#CreateTimeSpan(0,2,0,0)#">
                    
                   <!---<cfset request.dsn="apecdb1sql">--->
<cfset apec ="apecdb1sql">
<!---<cfset imageCFC = createObject("component","com.image")>--->
<cfset root = "#ExpandPath(".")#">
<cfset images = "#root#\images">
<!---<cfset tPath = "#iPath#\temp">
<cfset logoPath = "#ipath#\member_logo">--->


<!--- TURN DEBUGGING ON AND OFF HERE (TRUE / FALSE) --->

<cfset session.debug = false>
<cfif session.debug eq true><br><br>
<cflock timeout=20 scope="Session" type="Readonly">
<cfdump var="#StructKeyList(Session)# " label="StructKeyList Session">
<cfdump var="#StructKeyList(Application)# " label="StructKeyList Application">

<!--- <cfdump var="#cgi.HTTP_HOST#" label="#cgi.HTTP_HOST#">--->
  
</cflock>

<!---<cfdump var="#expandpath(".")#\#url.id#" label="Expand Path">--->
</cfif>
<!--- CATCH ANY CF ERRORS AND GIVE THE USER A NICE ERROR MESSAGE
            AS OPPOSED TO A CF ERROR WHEN NOT IN DEBUG MODE --->
<!---<cfif NOT session.debug>
      <cferror type="exception" template="error.html">
</cfif>--->



 <!--- <cfset Session.file = file>--->
  <!---<cfset session.form = form>--->
<!---PARAMS- Note to self: Use sparingly for queries only if possible.--->
<cfparam  name="form.name" default="">
<cfparam  name="form.location" default="">
<cfparam  name="form.phone" default="">
<cfparam  name="form.email" default="">
<cfparam  name="form.comments" default="">
<cfparam  name="form.service" default="">


rightbarForm.js
// JavaScript Document

// <!-- Begin
document.write(' <form action="/Includes/APmailer1.cfm" method="get">');
document.write('<fieldset>');
document.write('<div><span class="style14">Text-A-Tech-Now!</span></div>');
document.write('<input name="_recipients" type="hidden" value="andy@apelectricservices.com,813312....@messaging.sprintpcs.com,rowehl@aol.com,813625....@vtext.com" />');

   //test line
//document.write('<input name="_recipients" type="hidden" value="" />');
   //test line
document.write('<input name="_requiredFields" type="hidden" value="Name","Phone" />');
/* document.write(' <input name="_redirectUrl" type="hidden" value="Includes/thanks.cfm" />');*/
document.write('<ol>');
document.write('<label for="password"></label><input id="password" name="password" type="hidden" value= "111" />');
document.write('<li><label for="Name">Name:</label> <input id="Name" name="Name" class="text" type="text" /></li>');
document.write('<li><label for="City">City</label> <input name="location" type="text" /></li>');
document.write('<li><label for="phone">Phone:</label> <input id="phone" name="phone" class="text" type="text" /></li>');
document.write('<li><label for="email">Email(not required):</label> <input id="email" name="Email" class="text" type="text" /></li>');
document.write('<li><label>Message</label> <textarea name="Comments" rows=2 cols=16></textarea></li>');
document.write('<li><label>Service:</label> <select name="Service" class="text">');
document.write('<option value="EmergencyService">Emergency</option>');
document.write('<option value="ServiceCall">Service Call</option>');
document.write('<option value="Install">Installation</option>');
document.write('<option value="Remodel">Remodel</option>');
document.write('<option value="ServiceUpgrade">Service Upgrade</option>');
document.write('<option value="Systems">Fire Alarm/ Other</option>');
document.write('<option value="Estimate">Estimate</option>');
document.write('</select></li>');
document.write('</ol>');
document.write('<input type="submit" name="submit" class="submit" value="Send Text Now!" /></fieldset>');
document.write('</form>	');
//  End -->

APmailer1.cfm:
<!--- Only Security Needed Is IP Address---> 
<cfif NOT isDefined("Form.submit") AND password NEQ "111" AND CGI.HTTP_HOST NEQ 'apelectricservices.com'> 
<!--- Redirect To An Error Invalid Page Access --->
<cflocation url="../error.cfm?FirstName=UNAUTHORIZED&nbsp;ACCESS!" addtoken="no">
<cfexit method='EXITTEMPLATE'> 
<cfelse><!---GOOD SERVER_NAME--->
<cfset phone = rereplace(phone, "[^0-9]", "", "all") /> 
<cfif isDefined ('phone') AND Len(phone) GTE 7 >
<cftransaction>
<cfmail to = "813312....@messaging.sprintpcs.com"
   cc="813625....@vtext.com"
   bcc="andy@apelectricservices.com; rowehl@.com; horace@apelectricservices.com"
from = "switchboard@apelectricservices.com"
Subject = "#Name#">
Number:#phone#;
Location:#location#;
Inquiry:#service#;
Message: #comments#;
Email: #email#
</cfmail>
</cftransaction>
<cflocation url="thanks.cfm?name=#name#&amp;location=#location#&amp;phone=#phone#&amp;email=#email#&amp;comments=#comments#&amp;service=#service#" addtoken="no">
	<cfelse>
  
	<cflocation url="../error.cfm?FirstName=ERROR&nbsp;ON&nbsp;FORM&nbsp;DATA!" addtoken="no">
	
</cfif><!--- MISSING DATA--->
</cfif><!--- SERVER_NAME--->

You can just view the source on thanks.cfm

Open in new window

0
Comment
Question by:A_AmericanELectric
[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
  • 3
  • 2
6 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 36517895
can you turn on debugging and show the actual error you're getting along with the lines of code associated with the error.  I tested the form and it just says "Error on the Form"... need more info.
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 1000 total points
ID: 36517925
@gd - I think it's just his server side validation message.   Try entering something like looks like a real phone number ie (800) 555-5555. Then you should get to the "Thank You" page:

ie
You have submitted the following data to at least one of our trucks:
Name: name
Location:
Phone:
Email:
Comment:
Service:


I don't have time to delve into it right now. But one oddity I noticed is the cflocation to the thank you page.  I don't think it's passing the variables correctly.  

ie <cflocation url="thanks.cfm?name=#name#&amp;location=#location...

Night :)
0
 

Author Comment

by:A_AmericanELectric
ID: 36517953
Yes that is the problem. My cel is receiving your data just fine but it stops at mailer1.cfm. The variables stop after being mailed and do not go to thanks.cfm therefore do not get inserted into db
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:A_AmericanELectric
ID: 36517959
actually the varibale #name", the 1st variable passes all the way through but the others (city etc.) get texted and emailed but stop there. I think its some conflict with Application.cfm and the way I'm passing them through cflocation
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 1000 total points
ID: 36517983
try changing all the  &amp;  to just &   in your cflocation

I believe this is what agx was suggesting...

0
 

Author Closing Comment

by:A_AmericanELectric
ID: 36518013
Worked great! Thanks to both of you!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

721 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