How to clear unneccessary fields after changing states of another fields?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jtblalock’s picture

I'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.

Patrick Bauer’s picture

+1
Same issue here.

youkho’s picture

Same issue too

peppchios’s picture

Same issue here.
Any ideas?

  • peterpoe committed ebb9e3f on 7.x-3.x
    Issue #2449311: "Emptied" state not work
    
peterpoe’s picture

Status: Active » Fixed
TheJoker’s picture

Status: Fixed » Needs work

peterpoe, I do not work, do not reset the price

peterpoe’s picture

@TheJoker: Please provide some context (at least field types used and dependency configuration), it's very hard to debug otherwise.

TheJoker’s picture

FileSize
327.19 KB

If 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!

lisotton’s picture

We tested and it's working fine.

Just posting the patch file.

lisotton’s picture

Status: Needs work » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: emptied_state_not_work.patch, failed testing.

argh911’s picture

This 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.

NWOM’s picture

Status: Needs work » Fixed

Closing 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?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.