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

SetField does nothing #492

Open
MattiaVerticchio opened this issue Oct 7, 2024 · 1 comment
Open

SetField does nothing #492

MattiaVerticchio opened this issue Oct 7, 2024 · 1 comment

Comments

@MattiaVerticchio
Copy link

Hi! First and foremost, thank you for creating elm-pages! 😁

I'm working on a hobby project and implementing a simple suggestion box with autocomplete functionality using the Forms API. My goal is to have a click on a suggestion automatically populate the input field. I tried using the built-in Effect.SetField, but it didn't produce any results.

Upon examining the source code in src/Pages/Internal/Platform.elm, I discovered that this feature hasn't been implemented yet. I'm curious about how this should work. If it's simply a matter of using Dict.insert to add the new value to model.pageFormState, I'd be happy to submit a pull request if you're open to that.

Please let me know your thoughts on this approach or if you have any alternative plans, thank you again!

@dillonkearns
Copy link
Owner

Hello! Ah yes, you're right, it looks like this isn't implemented:

, setField =
\_ ->
--Task.succeed (SetField info) |> Task.perform identity
-- TODO
Cmd.none

I believe the Dict.insert is indeed all it would be. I would gladly accept a PR on that. It would be great to have something in the end-to-end tests for that. Maybe in this test file https://github.com/dillonkearns/elm-pages/blob/master/examples/end-to-end/cypress/e2e/form-submissions.cy.js, which is exercising code in this example Route https://github.com/dillonkearns/elm-pages/blob/5654b80f4db85f471832146559404afc3c081fcb/examples/end-to-end/app/Route/Form.elm. Let me know if you have any questions! Happy to discuss on Slack as well.

Thanks for the issue!

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

2 participants