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
[com_fields] Readonly is not working for field types color and editor #13665
Comments
That's actually not an issue of com_fields by itself. There is an easy "fix" for the respective field plugins in that we just remove the "readonly" parameter, however it would still have the issue that ACL wouldn't work for those types.
|
@Bakual Thank you for explaining. I will have a closer look to the easy "fix" today. |
On the other hand having a required field which isn't available for editing is quite useless, Maybe better don't show it then? |
@Bakual You are right. In Joomla! it would be better to un-publish this field. But it is confusing for people who are knowing the html5 rules and who are new in Joomla!. They would expect the “normal” field behavior. At least we need to document it. |
@laoneo you know the use case behind that? |
It's basically a supported field in HTML forms to show the user the value of the field, but that it's not editable. |
@laoneo So can we remove the field? |
Imho, we should fix the formfields, should be easy for the color one. The editor one may be a bit tricky. |
Do whatever you think is best as you are not the first one raising this question |
For the color formfield see #13677 |
so theres a tricky fix on the editor-formfield open. |
Best bet is probably to return a simple textarea ( |
Also the User editor field (and contact Mail editor field) is editable with ACL set to no edit. But the User editor field not work, no data saved if ACL set to no edit. |
As for the default ACL settings, that's a different issue. You can see the (closed) issue here: #14336
It is shown in the permission tab, so the administrator can know it. Honestly, custom fields will have some learning curve associated with it. It's not hard to use, but there are some tricks you will have to know when working with it. Documentation is key here. |
Sorry but no Documentation about ACL permission for custom field :( |
@AlexRed guessing Documentation is coming up. |
Custom fields aren't released yet, documentation is still a work in progress. Hopefully someone also writes something about ACL there.
Yep, there is a bug that the editor doesn't support readonly/disabled, that is what this issue here is about. Unfortunately nobody stepped up to add that to the editor formfield yet. |
It is a bug in the editor and that should not be solved with a particular setting which nobody will understand. The point is that the bug in the editor must be solved and not done some workarounds. |
If you think we should hide the fields instead of showing them disabled when they are not editable then please open an issue for that. |
Hiding them just creates a different support issue. "I added fields and they don't display" |
yes but solve the issues with the editor and also now you have the same support issue. "I added fields and they are not editable" |
But should we then not try to fix the editor instead of workarounding things? |
CodeMirror has a readOnly option - https://codemirror.net/doc/manual.html If the editor form field, editor plugins, and JEditor can't somehow enable these, that is the bug that needs to be fixed. |
Exactly!! |
I had a look if I can get the editors into readonly mode. For codemirror I was able to set that flag hardcoded in the editor plugin, for TinyMCE I couldn't figure out yet where I would have to set it. |
tinyMCE.init({
...
theme : "advanced",
readonly : 1
}); should do it! |
or client side using Joomla's new API: Joomla.editors.instances['article_text'].instance.setMode('readonly'); |
But how does the plugin know when to set it? It doesn't know anything about the formfield and the formfield doesn't know anything about the editor. |
Put it in the params array. |
The params array unfortunately isn't passed to the editor plugin display method neither. It's only used to initially instantiate the editor, which is only done once per pageload. The codemirror onDisplay method has this signature: However when you look at what is passed from JEditor to this event it is:
$asset, $author and $params aren't even passed to the method and they are also unused in the method (not so surprisingly). |
Please test #15157 |
Closing as we have a PR |
Steps to reproduce the issue
Create a field of type color or of type editor and assign the option read-only. You can find this option on the register options.
Expected result
When I create an article the field should be read-only
Actual result
It is possible for me to edit this fields.
System information (as much as possible)
Additional comments
The text was updated successfully, but these errors were encountered: