-
Notifications
You must be signed in to change notification settings - Fork 344
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
UI Disabled Inputs #1305
UI Disabled Inputs #1305
Conversation
@@ -1,5 +1,5 @@ | |||
<div id="container-{ID}" class="form-control form-control-sm il-input-tag"> | |||
<input type="text" id="{ID}" value="{VALUE_COMMA_SEPARATED}" class="form-control form-control-sm"/> <input type="hidden" id="template-{ID}" value='{NAME}[]'> | |||
<input type="text" id="{ID}" value="{VALUE_COMMA_SEPARATED}"<!-- BEGIN disabled --> {DISABLED}<!-- END disabled --> class="form-control form-control-sm"/> <input type="hidden" id="template-{ID}" value='{NAME}[]'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is not enough here. Technically, the tag-input will be disabled, so that the user cannot modify it. But visually, it still looks enabled because of the < div > over it. The user can also click on it and on the first click, even a pointer comes up.
My idea would be to additionally extend the < div > with a "disabled" class. Adding some css for the color and pointer-event would make the division visually disabled for the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tfamula really nice work and awsome timing. As @klees pointed out, where where just writting this on a todo list of ours when this came in. Nice. The interface change lgtm. I think we can discuss this directly at the JF since the change of the interface is really small. I'll attach the according label.
Nice work on the examples. Note that for a merge you need to:
- Add some test coverage of this new "feature".
@@ -1,5 +1,5 @@ | |||
<div id="container-{ID}" class="form-control form-control-sm il-input-tag"> | |||
<input type="text" id="{ID}" value="{VALUE_COMMA_SEPARATED}" class="form-control form-control-sm"/> <input type="hidden" id="template-{ID}" value='{NAME}[]'> | |||
<input type="text" id="{ID}" value="{VALUE_COMMA_SEPARATED}"<!-- BEGIN disabled --> {DISABLED}<!-- END disabled --> class="form-control form-control-sm"/> <input type="hidden" id="template-{ID}" value='{NAME}[]'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general, and thx a lot again.
As far as I understand investigations of @chfsx into the general state of the disabled
-Attribute, not all browsers will properly display all types of disabled fields, so we might need some additional CSS at some point for some browser.
The changes in this PR currently do not cover Group
, Section
, MultiSelect
, Numeric
and Password
(or I am missing something crucial). These are Input
s (hence get the disabled
-property by the base class) but currently do not show any meaningful behaviour when the property is set. For Group
and Section
users imo would expect, that the contained inputs are disabled, the others should be just disabled like all other fields.
Did you check what happens when you actually process input from disabled fields?
Jour Fixe, 12 NOV 2018 : We accept this PR for trunk. Thomas will tackle Group and Section inputs, Richard will take care of Required inputs before committing it to trunk. |
Imo we should simply skip disabled inputs in the withRequest/withInput loop. We should not try to pass the values somehow through the request, since we cannot ensure that the values are not manipulated. Consumers must not construct the form differently for the initial presentation and the input processing. This follows up on the content/data discussion. Imo we need a function that runs through the operations without taking the request data. So basically a
|
@alex40724 Yes, I agree. We should skip the client-server-roundtrip that |
Hi @Amstutz and @klees, We also added the possibility to make
My investigations are different. For all Inputs which we have in the KS currently, the |
My investigations were for the attribute "readonly" not "disabled": https://www.w3schools.com/tags/att_readonly.asp |
Hi @tfamula, I'm really busy this week, but I promise you to give a feedback till end of the week. Sorry for the delay. |
Hi @klees, no problem. I just finished everything that was missing in my eyes and made some small changes here and there. I would like to say a few words about the Tag Input: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, besides the two minor issues in the comment. Thx a lot again.
@Amstutz: do you want to have another look?
@@ -42,4 +42,15 @@ public function __construct( | |||
$this->inputs = $inputs; | |||
} | |||
|
|||
function withDisabled($is_disabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add public
here.
{ | ||
$inputs[$key] = $input->withDisabled($is_disabled); | ||
} | ||
$this->inputs = $inputs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates immutability of the object. Please clone before you assign.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx a lot for adding the tests. @klees you may merge as soon as your points are taken care of.
Hi @klees,
I think this is not part of the PR and will be solved by you separately. |
Possibility to make inputs disabled in Forms and (future) Filters.
The need of disabled inputs came up by implementing the Filter