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

Add a way to disabled/read-only a field in forms. #2226

Closed
pragatiwagh opened this issue Jul 20, 2022 · 9 comments
Closed

Add a way to disabled/read-only a field in forms. #2226

pragatiwagh opened this issue Jul 20, 2022 · 9 comments
Labels
dashboards how administrate presents fields and displays data feature new functionality that’s not yet implemented

Comments

@pragatiwagh
Copy link

Sometimes we have a behavior where we want to disable or hide a particular field in form.

For instance I don't want to allow user to edit certain fields in the form, with current behavior I have to write a custom field or have a conditional handling to manage such a behavior.

@jubilee2
Copy link
Contributor

jubilee2 commented Aug 9, 2022

is that good ideal to passing the html options through Field options?

@pablobm
Copy link
Collaborator

pablobm commented Aug 12, 2022

Unfortunately, at the moment there isn't a way to hide/show form fields depending on dynamic conditions.

@pablobm pablobm added feature new functionality that’s not yet implemented dashboards how administrate presents fields and displays data labels Aug 12, 2022
@jubilee2
Copy link
Contributor

@pragatiwagh is this meet your requirment?
#1991

@pragatiwagh
Copy link
Author

@jubilee2 With #1991 we can restrict what fields to be included in edit/update. What i want to achieve is have a field in edit form too but as read-only. So it user knows what it is but cannot edit it. I think this would be common behavior for many applications and would be really helpful if we could something like this with simple configuration.

@pragatiwagh pragatiwagh changed the title Add a way to disabled/hidden a field in forms. Add a way to disabled/read-only a field in forms. Aug 20, 2022
@jubilee2
Copy link
Contributor

jubilee2 commented Aug 20, 2022

Understand I have this need also

@jubilee2
Copy link
Contributor

jubilee2@99f10e3

@pablobm is this good ideal?

@jubilee2
Copy link
Contributor

if think this way is good then i can create a mr but for document i am limited to do write too much,

@pablobm
Copy link
Collaborator

pablobm commented Sep 29, 2022

Perhaps I didn't understand correctly. Do you want this field to be disabled for every user, or only for certain users?

If it is for every user, you could do it with a custom field instead of changing an existing one. This custom field would not have a form field in it, or it would have a form field with the disabled attribute.

However, if you want that different users can see this field differently (enabled or disabled) then that's more problematic, as Administrate doesn't support this at the moment.

@pablobm
Copy link
Collaborator

pablobm commented Apr 7, 2023

I think this is a duplicate of #1862, so I'm closing it in favour of the former.

@pablobm pablobm closed this as completed Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboards how administrate presents fields and displays data feature new functionality that’s not yet implemented
Projects
None yet
Development

No branches or pull requests

3 participants