Support » Plugin: Contact Form 7 - Conditional Fields » Message subject related to the recipient

  • Resolved nexusfred

    (@nexusfred)


    Hello,

    I would like to use Conditional Fields for Contact Form 7 to let the sender choose a message subject related to the recipient.

    I build something like this:

    <label> To Mister [select* Recipients class:select default:get "Orange|orange@test.test" "Black|black@test.test"  "Green|green@test.test"]</label> 
     
    	[group Subject_Orange clear_on_hide]
    		<label> Select a subject for Mister Orange: [select* subject_Orange "Subject Orange 1" "Subject Orange 2" "Subject Orange 3" ]</label> 			
    	[/group]
    	[group Subject_Black clear_on_hide]
    		<label> Select a subject for Mister Black: [select* subject_Black "Subject Black 1" "Subject Black 2" "Subject Black 3" ]</label> 			
    	[/group]
    	[group Subject_Green clear_on_hide]
    		<label> Select a subject for Mister Green: [select* subject_Green "Subject Green 1" "Subject Green 2" "Subject Green 3" ]</label> 			
    	[/group]

    I set the Conditional fields like this:
    Show Subject_Orange if Recipients equals Orange
    Show Subject_Black if Recipients equals Black
    Show Subject_Green if Recipients equals Green

    But how can I add in the Object field only the subject selected ?

    Is there a way to change the value of [your-subject] with the subject selected ?

    Or set a hidden variable with the subject selected ?

    Thanks
    Best Regards
    Nexus

    • This topic was modified 1 year, 10 months ago by nexusfred.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    You should probably rename your groups to g_subject_black or something because even it it works now, it might stop working in the future, as all field names are unique and at some point i might decide to make everything case insesitive. (and some browsers maybe already do so)

    That being said you can simply add this to your subject line:

    [g_Subject_Orange][subject_Orange][/g_Subject_Orange]
    [g_Subject_Black][subject_Black][/g_Subject_Black]
    [g_Subject_Green][subject_Green][/g_Subject_Green]

    I kept the returns for readability so obviously you need to remove them and this:

    [g_Subject_Orange][subject_Orange][/g_Subject_Orange][g_Subject_Black][subject_Black][/g_Subject_Black][g_Subject_Green][subject_Green][/g_Subject_Green]

    Thanks !

    It’s work perfectly );

    Best Regard
    Nexus

    Plugin Author Jules Colle

    (@jules-colle)

    you’re welcome! please consider leaving a small review if you like the plugin

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Message subject related to the recipient’ is closed to new replies.