• Resolved daymobrew

    (@daymobrew)


    I have a number of Dropdown fields with a dash as the default value. Other values are numbers (it’s to choose how many of an item to order).

    To reduce ‘noise’ in the notification email I would like to exclude fields where the value is the default dash value.

    What is the easiest way?

    I did get it working but it is fragile:
    1) check field value using ‘wpforms_html_field_value‘ filter and note those that are not integers – I could not check for dash as dash == – !
    2) Use ‘wpforms_email_message‘ filter to search for section with the fields noted above and set the ‘table’ style to ‘display:none’

    If anything changes in wpforms-lite/includes/emails/templates/field-default.php my code will break.

    Is there another filter that I could use to stop the field table from being appended to the $message?
    Would you be open to a pull request for a new filter?

    • This topic was modified 3 years, 3 months ago by daymobrew.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @daymobrew,

    Thanks for contacting us!

    In case it helps, our notification emails exclude fields without input. It appears that you are using a dash as the first option in the Dropdown field, so if a user does not make a selection, the dash is selected by default.

    You may consider using the Placeholder Text option for the Dropdown field. When Placeholder Text is set, it takes the place of the first option and the Dropdown field is considered empty. Here’s a screenshot for quick reference.

    Thanks!

    • This reply was modified 3 years, 3 months ago by Prashant Rai.
    Thread Starter daymobrew

    (@daymobrew)

    Thanks for for this suggestion – this totally solved my issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I conditionally exclude fields from notification email?’ is closed to new replies.