how to send form data in orchard CMS

741 Views Asked by At

I'm using a form in my orchard website. How i can sent the form data to an email address?
My form is like

   <form>
       <input type="text" name="name">
       <input type="submit"name="submit" value="submit">
     </form>
1

There are 1 best solutions below

0
On

Orchard has built-in ways to do this. If you enable the Dynamic Forms, Email Messaging and Email Workflows Activities modules you can build forms and send emails with the submitted values, without writing a single line of code.

When you enable the Email Messaging module you will be prompted to configure the email settings. The only mandatory settings are Sender email address and host name. You can enter any email address here and use localhost for testing purposes.

If you want to show the form on every page, you don't need to edit the Layout.cshtml file. In fact there's rarely a reason to do so. Instead, go to the Widgets menu in the dashboard and add a new Form Widget to the default layer. Which zone you place it in is entirely up to you. In the editor of the widget you can build a form by dragging Dynamic Form elements to the layout.

Once you have your form set up, you can create a new workflow through the Workflows menu that sends an email every time your form is submitted. Simply start off with a Dynamic Form Submitted trigger to begin the workflow and link it to a Send Email activity. You can reference the form values in any of the email fields by using tokens, e.g.:

<div>Name: {FormSubmission.Field:Name}</div>

You can find step by step guides on dynamic forms and workflows in the official documentation: http://docs.orchardproject.net/en/latest/Documentation/Creating-Dynamic-Forms/ http://docs.orchardproject.net/en/latest/Documentation/Workflows/

Just ignore the part on Custom Forms when you get to Workflows, since those are outdated.