Skip to content
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

FormBuilder->submitOnChange is setting stay() and preserveScroll() without instruction #453

Open
stuartcusackie opened this issue Jun 21, 2023 · 0 comments

Comments

@stuartcusackie
Copy link

stuartcusackie commented Jun 21, 2023

  • Laravel Version: 10.13.5
  • PHP Version: 8.1.12
  • Splade JS Version (npm): 1.4.14
  • Splade PHP Version (composer): 1.4.14
  • Dev environment: Windows Laragon
  • Using Splade JetStream

Description:

I have a simple Form Class, with a single field that submitsOnChange:

$form
  ->action(route('handle-form'))
  ->method('POST')
  ->submitOnChange();

The page should redirect but in fact the page stays the same and I get an empty response. I noticed that my requests have these flags:

X-Splade-Preserve-Scroll: true
X-Splade-Prevent-Refresh: true

I did not set stay() or preserveScroll(), and I don't think there is a way to unset them. These have no effect:

  ->stay(false)
  ->preserveScroll(false)

If I use form components instead OR if I replace submitOnChange with a submit button then everything works fine. Seems like there's something wrong in the code and it is forcing stay() and preserveScroll().

Thanks. Awesome package so far!

@stuartcusackie stuartcusackie changed the title Redirect not working with FormBuilder Redirect not working with FormBuilder->submitOnChange Jun 21, 2023
@stuartcusackie stuartcusackie changed the title Redirect not working with FormBuilder->submitOnChange FormBuilder->submitOnChange is setting stay() and preserveScroll() without instruction Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant