Closed (outdated)
Project:
Conditional Fields
Version:
8.x-1.0-alpha6
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Oct 2019 at 19:33 UTC
Updated:
8 Jan 2024 at 15:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
the_glitch commentedComment #3
xxronis commentedIndeed, the scenario you describe should be covered by the "// On invisible make empty and unrequired." binding, in conditional_fields.js but that doesn't work.
The simplest scenario actually, with a target being unchecked when the trigger is unchecked does not work, tried all combinations (unchecked, value set up)
Comment #4
playful commentedSame issue.
Comment #5
xxronis commentedThis will kind of work for the checkbox going invisible, but its not great.
I believe the error comes from core states.js on.checked func
Comment #6
the_glitch commented@xxronis What does the patch do exactly?
Comment #7
xxronis commentedIt unchecks a target checkbox when it goes invisible. Setting a target boolean input as invisible in a condition should empty its value- if previously checked.
Comment #8
the_glitch commentedOK great. I'll give it a try once all the other drupal issues are out of the way.
Comment #9
the_glitch commentedJust tried adding a boolean as a control field to an image field. (Off state = invisible image field, on state = visible image field)
I added an image then turned the boolean to 'off' but image doesn't delete so the image saves to the node anyway.
Comment #10
the_glitch commentedPatch #5 doesn't work
Comment #11
xxronis commented@the_glitch Hold on, this (my patch at least) is about unchecking a previously checked and visible CHECKBOX, when another control field goes "Off" and the target goes invisible. Don't see how this would work for your image field to get emptied! this is for 2 dependent checkboxes (inputs), not some field with value, its only for booleans..
My scenario is:
Two checkboxes, when the trigger is unchecked, the target must go invisible and unchecked.
Checking the target, and then unchecking the trigger, must save my node with target value = false even if I had it checked (true) when visible.
Re-reading your description maybe I misunderstood. You probably need to clarify what target fields you mention here
Thanks
Comment #12
Sushma Gogula commentedI have recently upgraded to 8.x-1.0-alpha6 from 8.x-1.0-alpha5. However, I am also facing the similar error.
In this scenario, "Locations" field is dependent on "All Locations" field.
So, If "All Locations" is selected then "Location" field should not get saved and should get emptied. But, in this case it is saving both control field and target field, which is not expected.
Please advise if there are any workarounds or patches for this issue available already?
Comment #13
the_glitch commentedWelcome to Drupal Sushma. I see you're in Australia. Come join the Drupal Slack. There's an Australian channel and a support channel you'll probably find very useful.
Comment #14
Sushma Gogula commentedThanks @the_glitch. I will join and post this there.
Comment #15
the_glitch commentedHi xxronis
Yes your patch works well for unchecking checkboxes but if that checkbox is a control field that controls the visibility of another field, which holds a value such as an integer, then that other field's value isn't also cleared.
This is an important bug to address because if the checkbox is deselected by the function of the patch, then a user would assume that the value field that now isn't visible would also be cleared.
So to give you an idea of what I mean with the hierarchical structure:
- Taxonomy (select field with 2 taxonomy terms as control values)
- Checkbox (Boolean)
- Integer (variable input)
Taxonomy value 2 sets Checkbox to off, but off still needs to clear Integer value.
Comment #16
rajdeep0826 commentedComment #17
the_glitch commented@rajdeep0826 if your patch #16 is supposed to clear values in fields, when their state is made invisible, I'm afraid your patch doesn't work.
And if it's supposed to be unchecking checkboxes when that checkbox's state is invisible, there's already a working patch here for that.
Comment #18
prudloff commentedI think the script should restore the value when the checkbox is visible again or it is confusing for users.
I updated the patch to store the
checkedvalue and restore it.Comment #19
prudloff commentedComment #20
hmendes commentedHello!
Isn't this issue duplicated from # 2833343 -Re-add reset to default values option ?
Comment #21
gaëlg@hmendes: Yes, I think so.