Forward slash required for event to fire on form submit?
This is an open discussion with 3 replies, filed under General.
Search
There was a PR against the integration branch of 2.4 that added this into every new events code by default. But yes, this is a requirement on the action attribute due to the way Symphony redirect urls without forward slashes to urls with forward slashes and hence cos it's a redirect it wipes the post data.
Awesome, thanks for the clarification! Shame it didn't get added for the release… will surely cause much confusion amongst new users. Took me a good while to work out what was going on!
It has always been that way, and I must admit, it has been a forgotten headache for me many a time too.
Create an account or sign in to comment.
This is actually related to the issue I was having yesterday, I think: http://www.getsymphony.com/discuss/thread/106843/
Coming back to that same form I was finding that the event wasn't firing, again. I sighed.
Turns out, after some trial and error that it was due to a lack of forward slash at the end of the URL, so the page was getting a 301 redirect and not submitting properly.
The example code provided by the event was:
<form method="post" action="{$current-url}" enctype="multipart/form-data">
However for it to work I needed:
<form method="post" action="{$current-url}/" enctype="multipart/form-data">
Without that trailing slash the page just 301'd back to itself.
I think I actually fixed the form yesterday when testing via using
/?debug
and must have left the slash in place by mistake, subsequently removing it when doing more debugging this morning.Bug, server thing, or?