Plain contactform as a snippet

Hey all,

after getting the plain contact form running in a normal site template I would like to integrate it into a snippet to embed all over the site optional.

But inserting it via snippet the controller is not reacting on the submit. It is 1:1 out of the gist and functioning on a template based subside. Do I have to change the listener in the controller? return function($site, $pages, $page) ?

You have to pass the url to the page with the controller in the action attribute of the form.

Don’t understand this right… In the plain contact form I got the controller separated in another folder that is listening if a submit value is fired.

Does the file in the controller folder only work when there is a page with the same name as the controller?

Embeding the whole controller into the snippet does also not work…

What you need for the contactform to work is a page called contact with a contact.txt file in it, e.g.

/content/contact/content.txt

So if you call that URL, the contact.php template and contact.php controllers are called.

In your form, you then use this URL as the action attribute:

 <form method="post" action="<?php echo page('contact')->url() ?>>

Yes I did that but then i will be redirected to that page afterwards and thats not exactly that what I want. I thought I could call the controller global everywhere on the site…

So the snippet is used on multiple subsites and when it is filled out the user should stay on that and not be redirected to a new site.

Maybe to complex… Should insert just a link and deal the whole form stuff on that subsite…