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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to add disabled prop to all Fields or inputs. #1233
Comments
|
AFAIK |
|
This can be implemented in user land by building a custom |
|
For a project we built a custom |
|
Could |
|
|
If the user passes a custom React component, I would think they would either pass |
|
Why not using a https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset#Attributes |
|
Thanks @gtournie. For anyone else using antd, the inputs won't look disabled, so you might need a bit of CSS, eg this quick hack: fieldset:disabled input {
background: #ddd;
cursor: wait;
} |
|
Here's what I'm doing: function FormInput(props) {
return (
<Field name={props.name}>
{({ field, form })=> (
<Input
{...field}
disabled={form.isSubmitting || props.disabled}
error={
form.touched[field.name]
? form.errors[field.name]
: null
}
/>
)}
</Field>
);
} |
|
For material-ui form items, I have created a custom form component with an additional context. Form gets a |
usage: |
|
I think a plugin api would be the right way to add functionality like this. #3109 |
|
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days |
|
@gtournie thanks
|
馃殌 Feature request
I want to be able to make all Fields/inputs in a form be
disabledthrough the top level Form component. Our goal is that while submitting, we disable the form so the user can not change the fields during this time.Current Behavior
Currently you would need to pass
disabledprop to every input like this:Desired Behavior
Instead it would be nice to pass the disabled prop just to the Form and have it be passed down to the Field's.
Who does this impact? Who is this for?
This is helpful for anyone who has to regularly prevent users from filling out fields or wanting to toggle a form to be read only.
Additional context
Docs on the disabled attribute.
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Attribute/disabled
I have not done research on how this works with other types of inputs such as checkboxes or select.
The text was updated successfully, but these errors were encountered: