I'm trying to test form submissions, like contact pages, on my website, which is built on Orchard CMS.
I want it to work so that if a specific type of email input is entered, the form sends the email to me instead of the default email set in Orchard.
I've written a liquid syntax if
statement in the recipients input field config, but it did not work: it returns a a blank page, I guess the workflow does not continue, however when I refresh the page it says that could not send email.
{% if Request.Form.Email == "[email protected]" %} [email protected] {% else %} [email protected] {% endif %}
Here's an image showing this configuration in my CMS backend, where it explicitly says the input field supports Liquid.
The contact form is built with Workflows.
Update: I logged in today to test it, and I'm no longer encountering the issue with the blank page. Instead, I'm always receiving an email at [email protected], even if I enter [email protected] in the form input. The email sends correctly, and I can see all the details in the body, including the email address. However, it seems that Request.Forms.Email may be null or unavailable in the "Recipients" field.
I'm trying to test form submissions, like contact pages, on my website, which is built on Orchard CMS.
I want it to work so that if a specific type of email input is entered, the form sends the email to me instead of the default email set in Orchard.
I've written a liquid syntax if
statement in the recipients input field config, but it did not work: it returns a a blank page, I guess the workflow does not continue, however when I refresh the page it says that could not send email.
{% if Request.Form.Email == "[email protected]" %} [email protected] {% else %} [email protected] {% endif %}
Here's an image showing this configuration in my CMS backend, where it explicitly says the input field supports Liquid.
The contact form is built with Workflows.
Update: I logged in today to test it, and I'm no longer encountering the issue with the blank page. Instead, I'm always receiving an email at [email protected], even if I enter [email protected] in the form input. The email sends correctly, and I can see all the details in the body, including the email address. However, it seems that Request.Forms.Email may be null or unavailable in the "Recipients" field.
Share Improve this question edited Mar 12 at 11:07 KSJ asked Mar 11 at 12:50 KSJKSJ 12 bronze badges1 Answer
Reset to default 0{% assign email = Request.Form.Email | strip %}{% if email == '[email protected]' %} [email protected] {% else %} [email protected] {% endif %}
The issue was likely due to hidden characters, such as extra spaces or line breaks, in the Request.Form.Email value. This caused the conditional comparison to fail, even though the email appeared correct.
To resolve this, I used the strip filter in Liquid to remove any leading or trailing spaces from the input value before performing the comparison.