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

Allow a submit button to be disabled #1875

Merged
merged 7 commits into from
Dec 23, 2023
Merged

Conversation

amitaibu
Copy link
Collaborator

@amitaibu amitaibu commented Dec 23, 2023

Sometimes we may wish to have the submit button disabled. In my case, I later enable it via JS, if the form has changed.

renderForm :: LandingPage -> Html
renderForm landingPage = formFor landingPage [hsx|
    {(textField #title)}

    {submitButton {label = "Save Landing page", buttonDisabled = True}}
|]
image

@amitaibu amitaibu marked this pull request as draft December 23, 2023 14:44
@amitaibu amitaibu marked this pull request as ready for review December 23, 2023 16:57
@amitaibu amitaibu requested a review from mpscholten December 23, 2023 16:57
@mpscholten
Copy link
Member

Can we name the field disabled instead of buttonDisabled? This would be more consistent with the other field helpers (maybe you tried that already and it led to some compiler issue because of the duplicate field names)

@amitaibu
Copy link
Collaborator Author

maybe you tried that already and it led to some compiler issue because of the duplicate field names

Indeed, I've started with disabled, but it complained about ambiguous property here . If there's a solution for that, I'd also prefer to use disabled

@mpscholten
Copy link
Member

This error has no solution :D so then we're stuck with buttonDisabled

@mpscholten mpscholten merged commit d065883 into master Dec 23, 2023
2 checks passed
@mpscholten mpscholten deleted the submitButton-disabled branch December 23, 2023 21:37
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

Successfully merging this pull request may close these issues.

2 participants