Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Passing Form Vars To Final Page

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
A_AmericanELectric
Asked:
A_AmericanELectric
  • 3
  • 2
2 Solutions
 
gdemariaCommented:
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
 
_agx_Commented:
@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
 
A_AmericanELectricAuthor Commented:
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.

 
A_AmericanELectricAuthor Commented:
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
 
gdemariaCommented:
try changing all the  &amp;  to just &   in your cflocation

I believe this is what agx was suggesting...

0
 
A_AmericanELectricAuthor Commented:
Worked great! Thanks to both of you!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now