Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Keith

turn on/off 'edit' for each field depending if field has a value

I was hoping to be able to turn on/off “edit” during the dynamic creation of a Column… and, in general, I can…

… however, I want to be able to turn on edit *only if* a field has no value…
I don’t think I can do that during dynamic column creation right?

Is there a filter I can use to decide if “edit” is on/off on-the-fly for each field?

Thanks!
Keith

7 years, 2 months ago
Stefan van den Dungen Gronovius
Developer

Hi Keith,

Interesting use case. You could have a look at this filter:
https://www.admincolumns.com/documentation/filter-reference/acpeditingvalue/

If this filter returns ‘null’ (not empty or ”) then inline edit is not available.
So I believe by using this filter and the correct column checks you could disable inline edit for specific fields by turning thins around:

– Set edit value to null if there is a value
– Set edit value to ” if it is null or false (that is probably already the case)

7 years, 2 months ago
Keith

Thanks Stefan,

Worked beautifully!

I can now… on-the-fly… determine if a field should be “editable” based on settings in an Option Page for each role, for each field!

The setting choices I have for each role (for each field) are: ‘always editable’, ‘never editable’, and ‘if field has no value’..
… so… to accomplish the 3rd (only if field has no value)… using the ‘acp/editing/value’ filter was perfect!

7 years, 2 months ago
Stefan van den Dungen Gronovius
Developer

Sounds cool :)
I will close this ticket

7 years, 2 months ago

You must be logged in to reply to this topic.