-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Craft 4 vs 5: different behavior when using s-action #408
Comments
Are you sure? Can you show me the request URL without the fields in the query string params? |
That might not have been the best explanation of what I'm seeing - let me try again :) On Craft 4, the form reloads/refreshes when changing the select - but it doesn't post to my controller unless I click the submit button myself. But on Craft 5, the same form posts the controller straight away and then doesn't include any of the form fields The forms themselves and the controller are exactly the same for both versions. |
So it’s difficult to help you, seeing so little, but one thing I notice is that the 500 error appears to be the result of a POST request. Is that intentional? If you can send me some test code that I can use to replicate the issue then I’m sure I’ll be able to track it down. Right now my suspicion is that the forms are set up differently on your end. |
Closing due to lack of a response. |
Hey Ben, sorry for the delay. Both are GET requests. Full request on Craft 4 (form template here) On Craft 5: (form template here) Diffs of both files show they are identical but the behavior is different between the two and can't figure out why... |
I just tested the code you provided in the Sprig playground on a Craft 5 project and it works as expected. Can you please test this in your project (and possibly in a second project)? Note also that you reported that you’re using version 3.5.2 of the plugin, but 3.5.1 is the latest. <form sprig s-method="post" s-action="site/cp/save" >
<p>
<strong>{{ name ?? "Name not defined" }}</strong><br>
<strong>{{ option ?? "Option not defined" }}</strong><br>
</p>
<div>
<input id="name" type="text" name="name" value="{{ name ?? '' }}">
</div>
<div>
<select sprig name="option" id="option">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
<button type="submit">Submit</button>
</form> |
I'm using https://github.com/putyourlightson/craft-sprig-core, which is on version 3.5.2. I have this form in both a Craft 4 & 5 install and it behaves differently On Craft 4, changing the fields triggers sprig but doesn't submit the form to the controller. |
I managed to track this down to |
Thanks, updated and that did the trick! |
Great! |
Bug Report
I'm updating the last of my plugins for Craft 5 and I'm seeing a strange difference in behavior.
I tried a bunch of syntaxes and different forms but to no avail - hoping you can point me in the right direction :)
My form looks like this:
I have the same setup in my plugin and in Craft 4 this seems to work - so I'm not sure what the issue is.
Plugin Version
3.5.2
Craft CMS Version
5.57
PHP Version
8.2
The text was updated successfully, but these errors were encountered: