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

Implement form submission #178

Open
10 tasks
nicoburns opened this issue Jan 9, 2025 · 0 comments
Open
10 tasks

Implement form submission #178

nicoburns opened this issue Jan 9, 2025 · 0 comments

Comments

@nicoburns
Copy link
Collaborator

Suggested implementation plan

  • Modify Navigate event to take a Request rather than a Url
  • Form submission should be triggered on:
    • Click of <input type="submit" />
    • Enter key press when single-line text-field is focussed
  • Write a submission function that:
    • Iterates up the tree from the element that triggered the event looking for a <form> element (if no <form> element is found then do nothing)
    • Reads the action and method from the <form>
    • Searches the subtree under the <form> for input elements (we currently support: text, textarea, radio, checkbox, and hidden).
    • Composes a url and body from form attrs and input values.
    • Generates a Navigate event.

The initial implementation:

  • Wouldn't necessarily need to support all types (maybe just text and hidden?)
  • Wouldn't necessarily need to generate a "submit" event for Dioxus Native
  • Could assume enctype of application/x-www-form-urlencoded. But should maybe check for multipart/form-data and do nothing / log warning if it is set.

Although of course these features could be implemented (although probably no point doing multipart encoding until we have file inputs)

@nicoburns nicoburns added the enhancement New feature or request label Jan 9, 2025
@nicoburns nicoburns removed the enhancement New feature or request label Jan 20, 2025
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