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.

CommentFileSizeAuthor
#1 no.JPG3.72 KBakshita
#1 yes.JPG10.7 KBakshita

Comments

akshita’s picture

StatusFileSize
new10.7 KB
new3.72 KB

Please 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 :

<table cellpadding="2" cellspacing="2">

<tr><td><strong>Did you sign a contract?:</strong></td><td> &nbsp;</td><td> %value[other_info][did_you_sign_a_contract] </td></tr>
<tr ><td><strong>Date Signed:</strong></td><td>&nbsp;</td><td>%value[other_info][signed_info][date_signed]</td></tr>
<tr ><td><strong>Where Signed:</strong></td><td>&nbsp;</td><td>%value[other_info][signed_info][where_signed]</td></tr>
</table>

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' }
quicksketch’s picture

Status: Active » Closed (duplicate)

Duplicate 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.

akshita’s picture

This problem is fixed in the 7.x-4.x branch if you'd like to try out that version.

Is this webform module or webform conditional module?

akshita’s picture

@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

densolis’s picture

subscribe

akshita’s picture

@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 :


Notice: Undefined index: info in webform_tokens() (line 137 of /var/www/sites/all/modules/webform/webform.tokens.inc).

Please help how to fix this.

thanks in advance