aurovrata / cf7-grid-layout

A WordPress plugin extension for Contact Form 7 to design responsive grid-layout forms.
https://wordpress.org/plugins/cf7-grid-layout/
GNU General Public License v2.0
6 stars 7 forks source link

Enable label values for dropdown mail tags #39

Open aurovrata opened 1 year ago

aurovrata commented 1 year ago

Dynamic Dropdown fields have values and labels that differ.

When a user selects an option, the value is stored in the field and submitted.

user would like to have the label displayed in the mail tags rather than the value.

This can be achieved with the mail tag filter, but would be better to have it done automatically by the plugin.

aurovrata commented 1 year ago

There are 2 ways to achieve this,

  1. build the values to store both the value and the label, something along the lines of `value|label', which can then be split in a filter process when the mail tag value is generated and the value reset for the submitted field to ensure it is consistent with expected data.
  2. place a hidden field to capture the label value when the dropdown field changes, and use the hidden field value for the mail tag.

in both cases the functionality can be triggered by detecting the use of the corresponding mail tag.