Creating a custon form
Permalink
So I added a custom form as an HTML block, but what should I put as the action url in it? Do I need to create a new file or a new page in Concrete5 to handle the request?
Thanks Jordan,
I actually thought of a solution just after I posted this, I just simply pointed the action field to the current page where the form is and created the validation in the theme file for that page.
I actually thought of a solution just after I posted this, I just simply pointed the action field to the current page where the form is and created the validation in the theme file for that page.
Hello!
I have two things which are not clear to me: the action of the form, and how to validate fields..
How can I create required fields for example?
I have two things which are not clear to me: the action of the form, and how to validate fields..
How can I create required fields for example?
It's been a while since I wrote this response, and since then I've actually changed my mind about the external_form block -- it has a number of annoying limitations and quirks which make it very difficult to use a lot of the time (in my experience anyway).
What I do instead now is just create a block that has a form in it. I've put up a simple example of a contact form block, which shows things like how to handle the action of the form, and how to validate fields. The code is available here:
https://github.com/jordanlev/c5_custom_contact_form...
What I do instead now is just create a block that has a form in it. I've put up a simple example of a contact form block, which shows things like how to handle the action of the form, and how to validate fields. The code is available here:
https://github.com/jordanlev/c5_custom_contact_form...
YOURSITE/blocks/external_form/
(so you're copying it to OUTSIDE of the /concrete/ directory)
Then change the name of the test_form.php file in that folder AND in the "controllers" subfolder to something else (should be the same for both of those files, but different from "test_form"). Now you can modify that to your liking.
When you're done you can add the form to a page by adding the "External Form" block and choosing the form you made from the list.
-Jordan