External form email sending
Permalink
Hi,
I've been looking around the forums and I'm getting very confused about the whole sending form data to an email.
I'm trying to create a form in which people put details in and then all the data is sent to me.
I've created an external form but now I don't know what to do now? is there any code out there in which I can use or anything like that??
Thanks
Gary
I've been looking around the forums and I'm getting very confused about the whole sending form data to an email.
I'm trying to create a form in which people put details in and then all the data is sent to me.
I've created an external form but now I don't know what to do now? is there any code out there in which I can use or anything like that??
Thanks
Gary
Is it possible to somehow include the actual page title in the e-mail?
So like I have the same form on multiple different pages and I want to know on which page was the form filled?
So like I have the same form on multiple different pages and I want to know on which page was the form filled?
You could add a hidden field to your external form template which takes the collection name (or whatever collection attribute grabs you) as it's value.
Custom form are not that hard. However they require a few basic skills. We can help (Canada.) to do that.http://www.studiolettrage.ca
External Forms are made up of two or more files.
The form HTML
The form's controller file
Separate form JavaScript/etc (optional files)
Let's say we're going to create a form that allows a customer to send you a number of widgets.
We create a form in blocks/external_form/forms/my_widget_form.php that contains all the HTML markup to create the form. In the markup we have a form field quantity and a form field email.
Now we need to create a form controller to handle all the computations associated with this form - it is created in blocks/external_forms/forms/controllers/my_widget_form.php
There should be an example of a controller for the "Test Form" in concrete/blocks/external_forms/forms/controllers/test_form.php
In the controller, you'll create a function that matches your form's action. So if your action is "order_widgets" your controller will have a function called action_order_widgets.
In this controller function, you can add validation, handlers, database connections, etc.
You can also create an "on_page_view()" function to load form CSS and JS files. Here's an example:
For your particular problem (emailing) you'll need to make use of the mail helper (http://www.concrete5.org/documentation/developers/helpers/mail) you'll probably also want to look at validation (http://www.concrete5.org/documentation/developers/forms/basic-validation) and error handling (http://www.concrete5.org/documentation/developers/system/error-handling/) and finally, you may find front-end JavaScript validation (http://unwrongest.com/projects/valid8/) useful as well.