-
-
Notifications
You must be signed in to change notification settings - Fork 992
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
Selectlist values are not blankable #659
Comments
Something similar to what have been done with KD? https://github.com/ryanmitchell/ti-ext-kitchendisplay/blob/4a8f1e49fc75fb1222d2e34ba0c6cedcbe0608fd/models/Views.php#L38 |
Yep that’s my work around. Needs to be handled better in core. |
Using the |
Yeah I tried that, it doesnt seem to work with select list - because there is no form field value present it treats the field as missing so doesnt update the value. |
Using the language field on the admin staff form as an example.. I'm able to create a staff with multiple languages and then update the same staff with no language selected, so somehow the form field is passing the right value? or am I missing something? |
Maybe the difference is that the staff model field is a relation not a select list? I've tried quite a few ways of handling it (and have a work around), but a straight up standard select list cant be blanked. |
Ok, share your field configuration |
From the loyalty extension I'm working on...
|
I see what you mean with the form field value, apart from the workaround in the KD extension, how would you fix this within the |
The only thing I had thought of was adding something around here: TastyIgniter/app/admin/widgets/Form.php Line 753 in 1b83158
if type is select list and multiple then add a blank value if not present in $data - feels hacky but was the best i could come up with |
Ok, I see what you mean with the values but adding the placeholder option actually works, it sends an empty string array as the field value which in turn removes the value from the db
Another thing we can do is look into the bootstrap-multiselect js plugin to see if we can send an empty string/array when none is selected. |
Yea the bootstrap-multiselect plugin is a bit messy, maybe we can find a replacement for it? |
Hmm that seems like a big change this late in the cycle? I think I can make it work by adding a “Select none” option similar to select all - give me a couple of days.
… On 24 Jan 2021, at 02:26, Sam Poyigi ***@***.***> wrote:
Yea the bootstrap-multiselect plugin is a bit messy, maybe we can find a replacement for it?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#659 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAMVO2TIXX6MZDWWX4DU4LS3OAOLANCNFSM4V6Z73EQ>.
|
Both issues should be fixed with the PR here: |
This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue. If this issue is critical to your business, consider the Dedicated Support Service where a Service Level Agreement is offered. |
Raising as an issue instead of a PR as Im not sure how best to handle it.
The issue is that select lists cant be blanked once they have a value, even if they are not required. So to replicate, add a value, then save, then remove the value, and what you saved persists.
The text was updated successfully, but these errors were encountered: