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

LiveForm shouldn't crash if id attr isn't included #23

Open
bcardarella opened this issue Oct 18, 2024 · 4 comments
Open

LiveForm shouldn't crash if id attr isn't included #23

bcardarella opened this issue Oct 18, 2024 · 4 comments
Assignees
Labels

Comments

@bcardarella
Copy link
Contributor

To match the behavior of HTML, id isn't required when using <form phx-submit="save"> ... so <LiveForm phx-submit="save">... should have similar behavior.

We shouldn't be injecting an id either. The client should allow the developer to opt-in with recovery.

@carson-katri
Copy link
Contributor

I think this can be accomplished by creating a FormModel that's local to the LiveForm element if an ID is not present. If an ID is provided, the form model would be held by the coordinator.

@bcardarella
Copy link
Contributor Author

I want to aim for feature parity with HTML. Is there a reason why id would he required for SwiftUI? If not then I'd like to match HTML which works, but is less featureful, without id

@carson-katri
Copy link
Contributor

No reason why an ID would be necessary. I was just noting one possible implementation.

@bcardarella
Copy link
Contributor Author

Gotcha, I think we'll find ourselves with less WTFs later on if we match these primitive behaviors. I cannot highlight any one instance this would happen but its always the ones we don't anticipate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants