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

Checkbox fields with view only permission render incorrectly #2003

Open
hannaofsweden opened this issue Aug 29, 2016 · 9 comments
Open

Checkbox fields with view only permission render incorrectly #2003

hannaofsweden opened this issue Aug 29, 2016 · 9 comments

Comments

@hannaofsweden
Copy link

If you have a checkbox field with access set to "View" but not "Edit" for the current user, and you have "Show field in page editor if viewable but not editable", you get output like this:

1

It would be cleaner if the system could display a non-editable checkbox instead.

@LostKobrakai
Copy link

That's not incorrect, but I'd also like to see renderMarkup() used instead of renderValue() in that case. The latter does correctly return 1, whereas the first one would render a disabled checkbox.

@hannaofsweden
Copy link
Author

That's true.

Wonder if that's the case for the other fields that render incorrectly in
read-only mode, like Repeaters (renders a list of Repeater item IDs, e.g.
3883|83838|94949|8585)? Maybe just using renderValue() would solve all
those issues.

On Mon, Aug 29, 2016 at 11:17 AM, Benjamin Milde [email protected]
wrote:

That's not incorrect, but I'd also like to see renderMarkup() used instead
of renderValue() in that case. The latter does correctly return 1, whereas
the first one would render a disabled checkbox.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2003 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AALjoS-3AmVYI4srJaZJ4e84JHDwUzxOks5qkqPGgaJpZM4JvSB9
.

/Hanna

070 - 742 19 69
[email protected]

@LostKobrakai
Copy link

Yep, it's the same thing. But renderMarkup() is the one rendering markup, whereas renderValue() does render a value, which is the string of id's for repeaters.

@ryancramerdesign
Copy link
Owner

ryancramerdesign commented Aug 30, 2016

There is no Inputfield::renderMarkup(), do you mean Fieldtype::markupValue? In either case, the Inputfield::renderValue has a job of rendering the value for presentation purposes in the ProcessWire admin, which means markup is okay, but it shouldn't contain any inputs or things that look like inputs. In the case of a checkbox field, it's showing the value assigned to the checkbox. The default checked value is 1, which is what it shows when checked. So it's doing what it's supposed to, but maybe that's not clear enough. Though showing a checked or unchecked input isn't ideal either since renderValue isn't supposed to show anything that looks like an input. Maybe just text labels: "Checked" or "Not checked" or something like that. Will think about this one a little more and revisit. Thanks.

@ryancramerdesign
Copy link
Owner

Alright looks like I already thought this one through before. :) In PW3 (added months ago) we are already using a renderValue() method for InputfieldCheckbox and it renders a text label along with a checked or unchecked font-awesome icon. If you are already using PW 2.8 or 3.x and don't see this, please let me know. Thanks.

@teppokoivula
Copy link

Alright looks like I already thought this one through before.

That feeling when you dig into a potential problem.. only to find out you've already solved it :)

@NikoTechnik
Copy link

Seem to have the same problem whith files inputfield . PW version 3.0.98.
When i set field access to view only the field is completely removed in the page edit view.

@teppokoivula
Copy link

@NikoTechnik, I would suggest opening a new issue at https://github.com/processwire/processwire-issues. This repository (ryancramerdesign/ProcessWire) is for legacy stuff, so the issue is unlikely to get any attention here :)

@NikoTechnik
Copy link

Ok, thank you !

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

No branches or pull requests

5 participants