Solved

Passing Form Vars To Final Page

Posted on 2011-09-10
6
231 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 250 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
 Watch the Recording: Learning MySQL 5.7

MySQL 5.7 has a lot of new features. If you've dabbled with an older version of MySQL, it is definitely worth learning.

 

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 250 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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

623 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