This issue post is mostly for reference - original issue at http://drupal.org/node/1458140#comment-5912804
The old token system of using %value[fieldset][field] does not work properly on conditional fields. If a conditional field is never filled out, using %value[fieldset][field] in the email template will print [field] directly in the email. This is related to the code at http://drupal.org/node/991024 which strips out %value[fieldset] without removing [field].
Fortunately, the new token system works correctly, so posting [webform-submission:submission:text1] instead of %value[fieldset][field] will work properly.
I'll leave this open for now if others are using the old system and you think it should be supported, but feel free to close if not.
Comments
Comment #1
akshita commentedPlease help.
I have conditional fields on my form and I am customizing my email template.
If I select "No" option then the hidden field values are simply displayed as "%value[f1][f2]
For example:
In the email template :
Is there a way to control the display of the hidden field values for the selection "no" using javascript??
In the email template I tried the below javascript but no luck :
var a=%value[other_info][did_you_sign_a_contract]; if (a == "No"){ document.getElementById('formDiv1').style.display = 'none' }Comment #2
quicksketchDuplicate of #1332820: Parts of nested tokens (in fieldsets) printed when left empty.
This problem is fixed in the 7.x-4.x branch if you'd like to try out that version.
@Akshita: You can't use JavaScript in e-mail templates, since e-mail clients don't execute JavaScript. If you'd like to use conditionals in your form, you can use the PHP variable $submission that is available in that template instead of the tokens, which are replaced *after* the PHP is executed, so you can't use them for conditionals.
Comment #3
akshita commentedIs this webform module or webform conditional module?
Comment #4
akshita commented@quicksketch
Also tried $submission[other_info][signed_info][date_signed] instead of %value[other_info][signed_info][date_signed] but it displays as it is if there is no value entered for the field.
Please advice how to make use of $submission
Comment #5
densolis commentedsubscribe
Comment #6
akshita commented@quicketch
I did installed the webform 7.x-4.x and it works fine with conditional fields.
But On conditional field -when the user selects "No" - the email is sent with what ever values the user has entered but there is a notice displayed on the top :
Please help how to fix this.
thanks in advance