Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thread Starter richardchiriboga

    (@rchiriboga)

    thanks Takayuki, but I saw that one already. that’s not what I need though. I need to make it so that the user doesn’t select where the form goes, but the system does based on another dropdown condition.

    I know I’m necro’ing this, but for future reference, you can with the pipes article that Takayuki linked quite easily.
    You create a drop-down menu with whatever you wish to differentiate with. In your case, you may have an email address for Chicago you want to use. You simply put "Chicago|chicago@usa.com" in. It doesn’t even display the email address, keeping it safe from spammers.

    If you’re attempting to let people type their own city in, that will be more fun that you realize, as people can and will misspell their own city. However, you can simply have it as a text field (value of [City]) and as a form recipient put in "[City]@usa.com"

    I have a “Topic” popup that is using this method to send different messages to different people. It works great, but I need to have the name of the topic appear in the subject line of the generated email. The popup is called [your-recipient], and I use that in the “To” field to ensure it goes to the right email. But if I put [your-recipient] into the Subject line, it puts the email address rather than the title of the popup entry. Since several of the selections go to the same email address, we need to have the topic name appear in the subject line, rather than the email address. Is this possible?

    Thanks!
    -Mike Berg

    http://wordpress.org/support/topic/plugin-contact-form-7-pipes-get-before-value?replies=14

    Thats what you’re looking for. If you have problems message me

    That is exactly what I was looking for, but I don’t like that it modifies the plugin, making it necessary to patch the plugin every time it’s updated (if it doesn’t get included in an update).

    I decided to go with a somewhat kludgey workaround:

    Create a text field after the popup and set its default value to be the same as the default value of the popup. My popup is called “your-recipient” and the text field is called “topic”.

    Then use some jQuery:

    <script>jQuery(function($){
    	$('select[name="your-recipient"]').change(function(){
    		//set text of hidden field for email template purposes
    
    		if ('Beta Request' == $(this).val()) {
    			$('#topic').val('Beta Request');
    		} else if ('Questions and Comments' == $(this).val()) {
    			$('#topic').val('Questions and Comments');
    		} else if ('Bug Report' == $(this).val()) {
    			$('#topic').val('Bug Report');
    		} else if ('Press Inquiry' == $(this).val()) {
    			$('#topic').val('Press Inquiry');
    		}
    	});
    });</script>

    This sets the “topic” field to match the label on the popup. Then you can include [topic] in your email template.

    Once you’re sure it’s working, you can hide the “topic” text field with CSS.

    I have a similar problem and was wondering if anyone has a solution.

    I need to have the user select just the recipients City in the dropdown and “Chicago|chicago@usa.com” would work fine but, I also want to to include the recipients name for the message body and Mail To: to make it appear it’s directly to them.

    I can achieve this with [your-recipient]<[your-cityemail]> in Mail To: and two separate dropdown menus with the nearest location. I have one to select recipients name and the other dropdown for the email address. My problem is that there are over 100 locations and if the sender doesn’t select the same two cities, a recipient gets an email with the wrong recipient name.

    This is what I want to get rid of;

    <p>Select Your City<br />
    [select* your-recipient
    "Chicago|John Doe"]
    
    <p>Confirm Your City<br />
    [select* your-cityemail
    "Chicago|chicago@usa.com"]

    and this something like I’m trying to do;

    <p>Select Your City<br />
    [select* your-city
    "Chicago|John Doe <chicago@usa.com>"]

    The user would not see John Doe or chicago@usa.com from the dropdown and John Dow would show up in the message body (as a URl if needed) and John Doe & chicago@usa.com would go to Mail To for the mail header. It’s 3am and I hope someone can understand what I’m trying to say..

    Wouldn’t the Javascript method I described above help with that? Set your hidden text field to be the name of the person for each city, then write your JS so that when the user selects “Chicago” from the popup, it sets the hidden text field to “John Doe”. You’d have to set each name individually of course, but it’s better than having the user have to select the same city twice.

    I’ve try to use this jquery function, but I doing somethings wrong

    jQuery:

    <script>jQuery(function($){
    	$('select[name="menua1"]').change(function(){
    		//set text of hidden field for email template purposes
    
    		if ('1' == $(this).val()) {
    			$('#topic').val('aaaaaa');
    		} else if ('2' == $(this).val()) {
    			$('#topic').val('bbbbbbb');
    		} else if ('3' == $(this).val()) {
    			$('#topic').val('ccccccccc');
    		} else if ('Press Inquiry' == $(this).val()) {
    			$('#topic').val('Press Inquiry');
    		}
    	});
    });</script>

    Form:

    [select menua1 class:PPP"a|1" "b|2" "c|3"]
    
    [text topic class:PPP]
    
    <p>[submit "Wyślij"]</p>

    and message:

    [menua1]
    
    [topic]

    But topic is always empty.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Contact Form 7] send email based on dropdown value selected’ is closed to new replies.