Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
How to clear unneccessary fields after changing states of another fields?
Comment | File | Size | Author |
---|---|---|---|
#10 | emptied_state_not_work.patch | 1.09 KB | lisotton |
#9 | do_not_empty_field_080416.jpg | 327.19 KB | TheJoker |
Comments
Comment #1
jtblalock CreditAttribution: jtblalock commentedI'm seeing the same issue. We're using conditional fields to show a custom text box at the end of a check box list and are trying to empty the field if text is entered and then the custom check box is UNchecked, but the data isn't emptied and it's still saved to the db.
Comment #2
Patrick Bauer CreditAttribution: Patrick Bauer commented+1
Same issue here.
Comment #3
youkho CreditAttribution: youkho commentedSame issue too
Comment #4
peppchios CreditAttribution: peppchios commentedSame issue here.
Any ideas?
Comment #6
peterpoe CreditAttribution: peterpoe as a volunteer commentedComment #7
TheJoker CreditAttribution: TheJoker commentedpeterpoe, I do not work, do not reset the price
Comment #8
peterpoe CreditAttribution: peterpoe as a volunteer commented@TheJoker: Please provide some context (at least field types used and dependency configuration), it's very hard to debug otherwise.
Comment #9
TheJoker CreditAttribution: TheJoker commentedIf you switch the type of field should be updated with the price to zero, as the cost in terms. And the list must also be zeroed, if you switch the type of money, but this is not happening.
I tried. It seems that is "emptied" does not work in any combinations.
Maybe there is another way, or I did not do something right do. How to make that change when the previous field is reset to zero?
Thank you!
Comment #10
lisotton CreditAttribution: lisotton at CI&T commentedWe tested and it's working fine.
Just posting the patch file.
Comment #11
lisotton CreditAttribution: lisotton at CI&T commentedComment #13
argh911 CreditAttribution: argh911 commentedThis patch seems to be part of the latest dev build, but it still doesn't solve my issues.
I have a list, when value 1 is selected input1 must display, and be required, input2 is hidden. I have these set up and working.
When list has value 2, input1 is hidden, input2 must display and be required. I have these set up and working.
When list has value 2, input1 must be emptied. This does not work even with this patch.
Comment #14
NWOM CreditAttribution: NWOM commentedClosing this, since it has already been included in the newest dev.
@TheJoker: Please look at the following issue: #596612: Option to delete/reset values in hidden fields on condition change?