Hi
I’m trying to insert the uniform plugin. I’ve installed it, created the controller and the template.
But when I try to submit the form nothing happens. There is no php error an no error in the browsers dev-tool.
The controller and the template are copy/paste from the github instructions.
It seems that there is no validation. It doesn’t matter what info I submit, the form always gets sent. But without any error/success message. It looks as you would just reload the page instead of submitting.
If I insert the plugin in a fresh kirby-starterkit it works just fine. I can’t see any conflicting parts. I just have installed the column-plugin, no other plugins.
Could you please post your code? Especially the controller code and the form code from the template. Maybe you forgot something while copying the code.
=> No. There is nothing stored in the field on submitting. No error and no success message. It behaves almost like you would reload the page.
=> Yes, if I insert php <?php echo l::get('uniform-email-success') ?>or every other entry, it returns the value fitting it. I’ve let the language constants in the plugin folder and didn’t insert it in my language file. But even if I insert it there, nothing changes.
That’s a tough one. Can you make a minimal example of your page that is not working like you describe and send it to me as a ZIP or something? You can send me a private message with the ZIP, too.
Well, this is definitely one of the strangest bugs I’ve ever seen I’ll answer you publicly here because this might affect other Uniform users as well.
In your header snippet you generate the URL for a background image dynamically using PHP and set it as inline CSS. In your example site the PHP output for the background image is always empty (because there is no image), resulting in HTML like this:
<header style="background-image:url();">
Note the empty url()
What happens when the browser encounters an empty url() in the CSS, we can observe in the request log:
The page /eventregistration/ is fetched twice! When encountering an empty url() in the CSS, the browser requests the same URL of the page again and actually expects the server to respond with an image this time! Theoretically this is possible because the second request asks for an image MIME type as response but who would do such a thing?
As far as Uniform is concerned this second request is a very legitimate one (it doesn’t care what MIME type is requested) and it re-generates the CSRF token (the token of the submit button), invalidating the old token that was served with the first request on the way. Now if you try to submit the form, you will use the old invalid token and Uniform simply ignores the request.
To fix this, change the inline CSS to background-image:none instead of background-image:url() if there is no URL.