How to clear a chosen value from dropdown field

I have a dropdown field which I’ve programmed for the list of options to be dependent on another field selection in the form. This is working fine.

However, if user makes their choice in field_901 and then chooses a value in field_991, but then goes BACK to 901 and edits their choice, the value for 991 is still there and may no longer be appropriate.

So I want to first clear 991 whenever 901 is chosen, then set the list of dropdown options.

However, I cannot seem to get the value to be unchosen. I have tried all these methods:

        $('#view_789-field_991').val('').trigger('chosen:updated');

        $('#view_789-field_991').val('Select').trigger('chosen:updated');

        $('#view_789-field_991').val('');

Thanks in advance.

Hi @RobinB

Can you try this:

$('#view_789-field_991').val('').trigger('liszt:updated');

The reason is (I think) that Knack use an earlier version of the Chosen select.

Let me know if this works.

Craig

2 Likes

Yep, that’s what I needed. Thanks!

1 Like