Hey all (and @mzur) I’ve been trying to get a simple email form working with Uniform without success.
I’ve largely (almost entirely) copied the default code from the Github basic example as it fits my needs perfectly. As far as I can tell, everything is set up correctly, yet every time I click the submit button, nothing happens. The page refreshes and scrolls down to the form, the contents are gone, but there’s no message at all whether it was successful or not, also I am not receiving the emails at all. This happens even if I give the form an email like
Something even more bizarre is that when I test this on my local MAMP installation, the form “works” and there’s a success message, even though I receive no email (obviously). What’s going on here?
I don’t post my controller or my form template because it’s not working even when I directly copy the code from the tutorial… So I don’t think it’s anything that I’m doing on my end. Is there some extra configuration that I missed?
EDIT: So here’s something neat I guess, I managed to get it work, but only when my Kirby install is in a root directory i.e. not in a subfolder (or even a subdomain…).
Any idea why Uniform is failing when the Kirby is installed in a sub directory? I have the correct .htaccess file set (I think at least, everything else works log-in, etc.)
How do you run the website locally other than using your MAMP? Do you use the PHP development server? The dev server ignores
.htaccess files and only follows some simple rules to make websites work so I guess a Kirby website in a subdirectory may not work correctly.
@mzur I only use MAMP when developing Kirby locally with the document root set to my Kirby folder.
In any case, the main issue I’m having is that Uniform doesn’t work on my live server when Kirby is in a sub-directory ex: http://website.com/kirby/ – it only seems to work when it’s in the root directory: http://website.com/. Do you know what could cause this?
Does the rest of the website work on your live server? If you can’t navigate to a sub page, the
.htaccess isn’t configured properly. If the site is located at http://website.com/kirby/ the
.htaccess must contain:
Like I said in the first message, everything works, I can log-in, I can access the panel, everything loads correctly, etc. I have the Rewrite function set to my subfolder.
You can see the test site here: http://dev.lystco.dk/airbiz/
When I try to test the form, nothing happens, not even an error message. However, if I put Kirby in the root directory of the site so it’s at http://lystco.dk/ then the form works.
Okay, take a look at the request log when I submit the form:
So the POST request goes to
dev.lystco.dk/airbiz#form but is redirected to
dev.lystco.dk/airbiz/. Because of the redirect all POST data is lost and the form does nothing.
You can fix this by adding a
/ to the URL so it looks like this in the
action attribute of the form:
That worked perfectly – thanks so much for the help!