|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Passing form values to popup
Here is my dilemma. I'm using Matt Robinson's mail script (found here http://mysecretbase.com/Slowing_Down_CFMAIL.cfm) to slow down cfmail. However, instead of converting this entirely to fusebox, I want to open the cfmail page in a popup window (launched from a form) and have certain form fields passed to this window. Some code will help explain.
In the form, the client chooses which database they want to mail to.... ========================= in dsp_emailUsers.cfm <cfparam name="subject" default=""> <cfparam name="emailtype" default=""> <cfparam name="town" default=""> <cfparam name="whichtable" default=""> <script type="text/javascript"> function formpop() { formWin = window.open('http://www.myurl.com/newsletter/admin/index_mailbomb.cfm?&bombsaway=true&subject=form.subject&emailtype=form.emailtype&whichtable=form.whichtable&town=form.town','ScapeBomb','width=300,height=300,toolbar=no,location=no,directories=no,status=no,me nubar=no,scrollbars=no,resizable=yes'); if (formWin && !formWin.closed) formWin.focus(); return true; } <h2>S'cape Mailer </h2> <cfoutput> <form method="post" action="#self#?fuseaction=#xfa.emailSuccess#" name="scapemailer" class="center" onsubmit="return formpop()"></cfoutput> <div class="admin"> Subject: <br /> <input type="text" name="subject" size="50" style="margin-top:5px;" /> <br /><br /> Choose the mail format: <input type="radio" name="emailtype" value="text" class="radio"> Plain text <input type="radio" name="emailtype" value="html" class="radio"> HTML<br /><br /> Choose a database: <input type="radio" name="whichtable" value="client_test" class="radio"> Send Test <input type="radio" name="whichtable" value="client" class="radio"> Go Live <br /> </p> <br /><br /> <input name="submit" type="submit" value="Send mail" class="button" /> </div> </form> <cfelse> <cflocation URL="#self#?fuseaction=#XFA.loginFailed#&badLogin=true"> </cfif> This seems to be fine, UNTIL it goes to query the email database with the whichtable variable... in the ebomb_pop.cfm file ================= <cfsilent> <!--- standard variables ---> <cfset admin_mail = "server@cwc.co.nz"> <cfset ebomb_filename = "scapebomb_test.html"> <cfset request.dsn="scape"> <!--- TEST THREAD ---> <!--- Run Rate is the number of seconds between refresh ---> <cfset variables.RunRate=20> <!--- Query Run is the number of query rows (email addresses) that will be processed on each execution of this template ---> <cfset variables.QueryRun=50> <!--- pull the email addresses. Cache this query since its going to be re-used every few seconds. ---> <cfquery datasource="#request.dsn#" name="MailList" cachedwithin="#CreateTimeSpan(0,1,0,0)#"> SELECT FROM #whichtable# WHERE email IS NOT NULL </cfquery> etc etc it barfs and returns a whacky msaccess application error about 'C:\winnt\form.mdb could not be found'. But if I hardcode either client, or client_test in place of #whichtable#, everything works fine. Any ideas why this is happening? It's quite odd , bcos the other variables are passed just fine, and on the post process page of the original form I checked by outputting the value #whichtable#, and it always displays either client or client_test depending on which I have chosen. Maybe I need to use javascript to call the values in the popup? All help greatly appreciated. TIA MarkH |
|
#2
|
||||
|
||||
|
You're hashing in the variable "whichtable" as if it were a local or global CF variable, however it is a URL variable, so you need to identify it as such unless you have a procedure to convert URL variables in place:
#URL.whichtable# Also, have you looked at the URL that's coming in the pop-up? You're putting in form variables correctly, but not hashing them in so ColdFusion will just interpret the string literally. http://www.myurl.com/newsletter/admin/index_mailbomb.cfm?&bombsaway=true&subject=#form.subject#&emailtype=#form.emailtype# etc. MOST IMPORTANTLY, this whole thing will not work. You're trying to pull form variables into a JavaScript from the existing page. You can't do that. You need to re-arrange your whole system, mainly by using JavaScript to populate your URL string, or using the GET method for your form. |
|
#3
|
|||
|
|||
|
thanks for the reply bocmaxima,
it turns out that after all this a database for additional features was required and that made my job a lot easer..problem now solved. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Passing form values to popup |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|