Orchard Contact Forms

百般思念 提交于 2019-12-10 02:11:36

问题


I've been trying to setup a contact form via Orchard CMS v1.6 but I'm not really sure how to do it.

I tried installing the Custom Forms module but i think this isn't compatible with the latest version I'm using.

Any suggestions?


回答1:


The Custom Forms module is very powerful and flexible, but it's not obvious at first how to make a contact form using it. Once you've figured it out though you can do a lot more with it.

Step 1 - Create a content type for the contact information you want to collect

In /Admin/ContentTypes click 'Create new type' to make a type with all the info you want your user to fill in.

Step 2 - Create a Contact Custom Form Page

In /Admin/Orchard.Customforms create a new form. On the drop down for content type choose the new content type that you made in step 1. You probably want to also tick the 'Save the content item once the form is submitted' box. You don't need to as step 3 will show how to make it email you, but I like to do it in case there is a problem with email.

Step 3 - Create a rule to send you an email (In Orchard > 1.7 use a workflow)

In /Admin/Rules create a new rule.

In the events section select an event for When a custom form for types (Your new content type) is submitted.

In the actions section add an action to send an email. If you choose to send to admin, make sure you've given the admin user an email (or it just fails silently).

You can use tokens in the subject and body of the email. Mine looks like this:

**Subject:** Orchard Contact Form - {Request.Form:Contact information.Name.Text}

**Body:** Name: {Request.Form:Contact information.Name.Text}
Email: {Request.Form:Contact information.Email.Value}

{Request.Form:Contact information.Yourmessage.Text}

Name, Email, and Yourmessage are all the field names on the my 'Contact information' type. For you these will need to be the name of your content type and the fields you've added to it.

That's it.

Update: In Orchard 1.7 workflows have replaced rules. This blog post goes into more detail about how to use them to make contact form.



来源:https://stackoverflow.com/questions/14644156/orchard-contact-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!