• Is it possible to hide content inside the body of the mail if the user hasn’t filled the text field out?

    We have built a booking form for a bus jounrey and if the user selects “one way” which is a radio button, the title called “return date” still appears in the mail message.

    E.G.

    Return Date:[return-date] - [return-time]:[return-minutes]

    I’ve tried using other plugins but they do not work. Can this be achieved through the use of a hook/filter/shortcode to achieve something like the below?

    E.G.

    [if radiobutton="Return"]
    Return Date:[return-date] - [return-time]:[return-minutes]
    [/if]

    Thanks

    https://wordpress.org/plugins/contact-form-7/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Check this tuto. it might help you.
    Working example here

    Thread Starter strandcreative

    (@strandcreative)

    Thanks but this isn’t quite what I want. I can hide/show fields with jQuery fine on the front end, my problem is when we get the email through it contains the word Return Date whether the user has chosen “One Way” or “Return”:

    Journey Type:	One Way
    Start Date:	24/07/2016 - 1:00
    Return Date:	(blank space)

    and

    Journey Type:	Return
    Start Date:	12/09/16 - 1:00
    Return Date:	14/09/16 - 1:00

    I have typed “Return Date” out in the email body so if the user has selected “One Way” radio button on the front end, they still get a section of their email that says:

    Return Date: (blank space)

    I need to remove these words if the user selects the “One Way” option value on the radio button.

    Thanks

    If I understand, your form is working well but the problem appear in the mail sent?

    Check “Exclude lines with blank mail-tags from output” box in the Mail section. It should fix the problem.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Conditional Mail Tags’ is closed to new replies.