This project is read-only.

Form field values for sending email via rule (1.5.1)

Topics: Troubleshooting
Oct 8, 2012 at 2:45 PM
Edited Oct 8, 2012 at 6:59 PM


I am trying to create a rule that would generate an email filled with some field values. This rule must will be triggered after someone fills a custom form with some fields, 'name, email, phone and message'.

Somehow I cannot get it working. I used the following in my e-mail body:

<li>Name: {Request.Form:ContactForm.Name.Value}</li>
<li>E-mail: {Request.Form:ContactForm.Email.Value}</li>
<li>Phone: {Request.Form:ContactForm.Phone.Value}</li>
<li>Message: {Request.Form:ContactForm.Message.Value}</li>

This way orchard only returns the email and phone fields, which happen to be input text fields. The other fields are 'plain' text fields and return nothing.

I then read about using Content.Fields instead. So my body became:

<li>Name: {Content.Fields.ContactForm.Name.Value}</li>
<li>E-mail: {Content.Fields.ContactForm.Email.Value}</li>
<li>Phone: {Content.Fields.ContactForm.Phone.Value}</li>
<li>Message: {Content.Fields.ContactForm.Message.Value}</li>

Now I get nothing. I tried using the format 'Content.Fields:xxxx' with semicolon but it didn't help.

The names of the fields are triple checked. The name of the form is indeed 'ContactForm'.

What do I do wrong, and where in which documentation can I find how to set this up properly?


Oct 10, 2012 at 1:25 AM

Can you explain what the difference is between input text fields and plain text fields?

Oct 10, 2012 at 9:57 AM
Edited Oct 10, 2012 at 9:58 AM


When editing the content type for my Custom Form I had the choice between several Filed Types for my fields. Two of the field types to be chosen here are Text Field and Input Field.

(plain text)
After the initial setup of the field, you can define some extras for that field. For the text types you can choose between 'Default flavor, narrow, wide, large, html and textarea. The latter is usable for a messagebox input that is several lines high.

(input field)
An inputfield type has an option to define a regex validation pattern.

As mentioned before: Using tokens in a rule I can create an e-mail, but the field values for the 'text field types' don't show.

What do I do wrong?

Oct 10, 2012 at 5:14 PM

Ah ok, I see. I was against the creation of two separate field types for text, it's confusing everyone... Anyway, {Content.Fields.ContactForm.Message.Value} should work, if ContactForm is the name of your content type. I would file a bug as this looks like a clear repro.

For the request tokens, I would check the network tab in the developer tools of your browser to see the real name of the form fields.

Oct 10, 2012 at 7:38 PM

In the long run I got it to work thanks to your suggestion to check the real names of the fields.

However, the {Content.Fields.ContactForm.Message.Value} syntax does not work. I used {Request.Form:ContactForm.Phone.Value}.
What I noticed from the real field values was that the text types use the property Text while the Input filed types work with .Value.

So, this is what works for me right now:
<li>Name: {Request.Form:ContactForm.Name.Text}</li>
<li>E-mail: {Request.Form:ContactForm.Email.Value}</li>
<li>Phone: {Request.Form:ContactForm.Phone.Value}</li>
<li>Message: {Request.Form:ContactForm.Message.Text}</li>

If you think the Content.Fields.ContactForm.Message.Value (or Content.Fields.ContactForm.Message.Text, which didn't work either) should work, I could file a bug. Just let me know.

For the record, I tried te following syntaxes with no result:
{Request.Form:ContactForm.Message.Text}  -> semicolon with Text property
{Request.Form.ContactForm.Message.Text}  -> dot with Text property
{Request.Form:ContactForm.Message.Value} -> semicolon with Value property
{Request.Form.ContactForm.Message.Value} -> dot with Value property



Oct 10, 2012 at 9:42 PM

Yes, the field tokens should work. Please file the bug.