|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Well I can't leave any/everyone hanging so I'll post the code here - yes I figured it out and it works!
First the form and the drop down box: Code:
<form onSubmit="return checkFields();" method="post" name="thisform" action="process.php" enctype="multipart/form-data">
<select name="worktype" size="1">
<option value="">Choose one</option>
<option value="General Contracting">General Contracting</option>
<option value="Fences and Decks">Fences and Decks</option>
<option value="Lanscaping and Interlocking">Lanscaping and Interlocking</option>
<option value="Garden and Design">Garden and Design</option>
</select>
<input type="hidden" name="recipient" value="nothing">
</form>
Code:
<script type="text/javascript">
function checkFields() {
if (document.thisform.worktype.value == "General Contracting")
{
document.thisform.recipient.value = "this@gmail.com";
}
if (document.thisform.worktype.value == "Fences and Decks")
{
document.thisform.recipient.value = "that@gmail.com";
}
if (document.thisform.worktype.value == "")
{
document.thisform.recipient.value = "those@gmail.com";
}
}
</script>
|
|
|||
|
I am trying to do this same thing and I can't get the email portion to work.
I have changed the javascript to match my form name and in the email that I receive it populates the "recipient" field based on the drop-down I select. But the email isn't being sent to that person at all. My code is below. Code:
<script type="text/javascript">
function checkFields() {
if (document.facilityrequest.worktype.value == "Contact1")
{
document.facilityrequest.recipient.value = "contact1";
}
if (document.facilityrequest.worktype.value == "Contact2")
{
document.facilityrequest.recipient.value = "contact2";
}
if (document.facilityrequest.worktype.value == "")
{
document.facilityrequest.recipient.value = "my work email";
}
}
</script>
Code:
<select name="worktype" size="1">
<option value="">Choose one</option>
<option value="Contact1">Contact1</option>
<option value="Contact2">Contact2</option>
<option value="Lanscaping and Interlocking">Lanscaping and Interlocking</option>
<option value="Garden and Design">Garden and Design</option>
</select>
<input type="hidden" name="recipient" value="nothing" />
Code:
<CFMAIL TO="my work email address"
CC= "#FORM.Contact_Email#, #FORM.Recipient#"
BCC=""
FROM= ""
SUBJECT= "Facility Reservation Request Form (WebformWCAllowList)"
type="html">
<h3>Facility Reservation Request Form</h3>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border: 0px;padding: 5px;font-size: 12px;">
<cfloop index="x" list="#form.fieldnames#">
<tr><td style="border: solid 1px;">#x#</td><td style="border: solid 1px;">#form[x]#</td></tr>
</cfloop>
</table>
<cfsilent>
<!--- Note that I used the <CFSILENT> tag, this will kill the white space in this area so your email is not cluttered with white space. --->
<cfif FORM.Upload neq "">
<cfmailparam file="#attachment_local_file_1#">
</cfif>
</cfsilent>
</cfmail>
|
|
||||
|
So what is the error you're getting?
__________________
Join free dating sites and meet single people without paying a penny. |
|
|||
|
Thats just it, i get no error.
But none of the recipients i specify on my process page receive the email based on that #FORM.RECIPIENT# tag. The cfmail to and the cc gets their email fine. And in my email I receive the Recipient field is populating with the email address that the javascript says it needs to be, it just isnt getting emailed to that person. |
|
|||
|
I dont know what happened but everything i was seeing said it should be working and now all of a sudden it is. Maybe it was a hiccup on my coldfusion server. Sorry to bother you, great code, it works great.
|
|
||||
|
Not a bother at all...the site I used that code on isn't live anymore but it's good that you reminded me for later use...and welcome to WPW!
__________________
Join free dating sites and meet single people without paying a penny. |
|
|||
|
I do actually have another request. I have about 10 checkboxes on my form and the end user would like it that if any of those check boxes are ticked, a separate email goes to a new person.
Any easy way to accomplish this? |
|
||||
|
This might help you along the way...
<input type="checkbox" name="email-address" value="abc@email.com"> <input type="checkbox" name="email-address" value="def@email.com"> <input type="checkbox" name="email-address" value="ghi@email.com"> Then in your CF process pass the checked values in "form.email-address" as a list...then loop through the list using CFLOOP and append the values to one variable separated by commas. (keep the name of the checkboxes the same in this case) In the end you should have one variable - let's call it #CC-List# - with the email values. <CFMAIL TO="my work email address" CC= "#CC-List#" FROM= "" SUBJECT= "Facility Reservation Request Form (WebformWCAllowList)" type="html"> </CFMAIL> I haven't worked with coldfusion for years but I'm thinking this could get your started...although someone else could respond with much cleaner and more efficient way of doing this....
__________________
Join free dating sites and meet single people without paying a penny. Last edited by morestar; 10-27-2009 at 01:38 PM. |
|
|||
|
Actually while waiting on your reply I stuck with the existing javascript by adding additional lines of
if (document.facilityrequest.Podium_with_Microphone.v alue == "Yes") { document.facilityrequest.Maintenance_Recipient.val ue = "maintenance email address"; And created another hidden text field like you used such as <input type="hidden" name="maintenance_recipient" value="nothing" /> and on my cfmail added a cc of #form.maintenance_recipient# and it appears to be working. The only thing that sucks is on my form i have about 10 check boxes and I am not sure how to code it that if ANY of the checkboxes are selected to send email to Maintenance, I will have to for now just manually add the 2 lines in the javascript for each of the check box names and tie it to the hidden text box of maintenance_recipient. That should work I think. I can show you the live page if you wish. I would send it in a PM not on the forum. Last edited by DJ Ballistic; 10-27-2009 at 01:47 PM. Reason: Missing some text |
|
||||
|
Sounds good...
so what if you grab the values of the checkboxes as a list, into a variable? From there your CC field should easily be set to the list variable no? I think the values will all be separated by commas in ColdFusion.
__________________
Join free dating sites and meet single people without paying a penny. |
|
||||
|
maybe try:
<input type="checkbox" name="email-address" value="abc@email.com"> <input type="checkbox" name="email-address" value="def@email.com"> <input type="checkbox" name="email-address" value="ghi@email.com"> <cfset num-of-addresses=3> <cfloop index="#num-of-addresses#" list="#email-address#"> <cfset CC-List=CC-List & #email-address#> </cfloop> <CFMAIL TO="my work email address" CC= "#CC-List#" FROM= "" SUBJECT= "Facility Reservation Request Form (WebformWCAllowList)" type="html"> </CFMAIL> Tell me if this works at all...im trying im trying !!
__________________
Join free dating sites and meet single people without paying a penny. |
|
|||
|
The only problem I can see with changing he names of the checkboxes is I wont get the proper value that I need to see in the email. At least that's what I think. If checkbox is named "email_address" then the value of that checkbox, instead of being "Podium_With_Microphone" = Yes when selected, it would be Email_Address = Yes. Wouldn't it?
|
|
||||
|
Oh yes well of course...i was just using those values as fillers but I see what you're saying...so the value in one case, for the checkbox would need to be "Podium_With_Microphone" and once that values is checked it emails to a certain address right?
__________________
Join free dating sites and meet single people without paying a penny. |
|
|||
|
You are correct except the same person gets emailed, maintenance, whether one checkbox is selected or all of them are. Nobody else gets emails with those checkboxes, it will only ever be Maintenance.
|
|
|||
|
The last task I will end up having to do is on that form I sent you, when they select the seating style, they want a link to click on that shows them a photo of that seating style. I haven't a clue how I am even going to accomplish this one. But luckily i haven't been told to do that yet, but I know it is coming.
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What's the best time to send Email? | wenwilder | Marketing Strategies Discussion Forum | 10 | 02-01-2008 11:15 PM |
| Profile Based Item Selection and Auto-Shipping? | chrison600 | eCommerce Discussion Forum | 0 | 04-13-2007 12:46 AM |
| Help ! webproworld does not send me email notifications :( | marcel | WebProWorld: Guidelines/Announcements/Suggestions | 12 | 01-19-2006 04:36 PM |
| how to send html based email | bobkom | Marketing Strategies Discussion Forum | 5 | 11-10-2004 11:18 PM |
| mailform redirect based upon user selection | twopooches | Web Programming Discussion Forum | 5 | 06-25-2004 04:26 PM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |