Problem/Motivation
I have an conditional field that appears when user selects a value of another field.
When the node is saved and re-edited, the conditional field is not displayed - the user needs to select the corresponding value of the other field "again". Is this a misconfiguration of my fields or does this module not support this scenario?
Steps to reproduce
- Create a conditional field
- Select the trigger value in another field
- Enter the value in the conditional field
- Save node
- Re-Edit node
- The entered value in the conditional field is not visible (also it is in it)
Proposed resolution
Perhaps a misconfiguration?
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | afterpatchCondicional.mp4 | 3.84 MB | laisbonafe |
| #17 | beforepatchCOndicional.mp4 | 1.97 MB | laisbonafe |
| #9 | 3168929-9.patch | 676 bytes | hmendes |
Comments
Comment #2
opiSame here ; My first field (aka the trigger) is a select field handled by Chosen, you too ?
Comment #3
larisse commentedHello! I was unable to reproduce this error. Could you test in the dev version of this module, because I think that probably this error is fixed.
Comment #4
telegraph commentedFacing the same issue, when editing a node, the dependent (target) fields are hidden until the control field is re-filled.
Control field has 'insert value from widget' for input mode, the control field is an entity reference select list based on a taxonomy .
Have version: 8.x-1.0-alpha10 installed and also tested the dev version without success.
Comment #5
hmendes commentedHello!
I was unable to reproduce this error, could you help me @telegraph @opi @inna_rist?
These were the steps i followed:
Comment #6
gocaps commentedI did some testing on 8.x-1.x-dev, and can confirm that the bug exists when the dependency is controlled by an Entity Reference field, as mentioned by @telegraph in #4.
I was able to reproduce @hmendes test in #5 also, which further confirms the issue with Entity Reference fields.
Comment #7
hmendes commentedI'm trying to work on this issue, but just for the record:
The problem doesn't seems to be with the Entity Reference fields, but with the select field:
If we have a text or number select field without the value "0", it will work normally. However, if the control value is the value "0", it doesn't work.
The problem with the Entity Reference field, is that it puts the first value in the list as the value "0" (if we put the second value of the list as the control value, the conditional field works normally), but it is not happening to all Reference fields... I'm still trying to figure out what is the problem exactly.
Steps:
Comment #8
chucksimply commentedI can confirm this issue as well. Though it occurs for me on both select and radio widgets... entity reference fields (referencing taxonomy in my case).
Comment #9
hmendes commentedHere's the patch to fix the problem.
Please review.
Comment #10
hmendes commentedComment #11
chucksimply commentedUnfortunately, the patch did not work for me. For both Radio and Select options. Using 4.0.0-alpha.
Comment #12
hmendes commentedHello @ChuckSimply, could you provide the steps to reproduce your issue, please?
Comment #13
chucksimply commentedHere's my setup...
1) A taxonomy entity reference Conditional Field, controlling multiple other fields on a node form.
2) Go to a node/add form.
3) Select the conditional field value (via select or radio widget).
4) Dependent fields show up as expected, depending on the conditional field's value.
5) Save node form
Edit - Issue Area...
6) Edit the same node just saved.
7) Conditional field value shows, but all dependent fields hidden.
*Note - One of my conditional fields values DOES show some fields on edit. The fields that show are Number and all fields within a Field Group. Others are hidden. (it worked this way before the patch, so the patch had no effect on this)
8) Selecting a different Conditional field value, then back to the same value... shows the previously hidden fields.
Thanks again for looking into this!
Comment #14
hmendes commentedI'm going to take a closer look at this, but just one thing:
I tested this issue with the "Values input mode" as "Insert value from widget", the others input mode under "Set of values" are having problem when the value is "0" ( it affects the entity reference fields as well because the value for the first option of the select/radio is "0"). So if you are creating a conditional field with a select/radio field, and selecting the first option as the trigger value, and the input mode is "All of these values (AND)", or any option under "Set of Values". it will not work with this patch only.
I've created the issue #3221537: Values input mode with Set of Values not working with "0", but it still needs work as it didn't pass the tests. (didn't tried to solve both issues here because the #3221537: Values input mode with Set of Values not working with "0" is not happening only with select/radio fields).
Comment #15
chucksimply commentedAh gotcha. Yeah the two fields I mention that ARE showing on the node edit form are using "Insert value from widget." The ones not working are "Values input mode." So this makes sense.
I'll give your patch on the referenced issue a try (even though it failed) and report back over there.
Comment #16
hmendes commentedComment #17
laisbonafe commentedHi, I tested the patch of comment #9, the patch fixed the issue,
I add 2 videos the test process, before patch and after patch.
Comment #18
thallesLooks good to me!
Thanks @all!
Comment #19
thalles