Problem/Motivation

When Custom jQuery selector for control field is once filled.
I was not able to empty it, it didnt save to DB and the value was always there

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 3624242-clear-custom-selector.patch872 bytesgurkawal

Comments

anaconda777 created an issue. See original summary.

gurkawal’s picture

StatusFileSize
new872 bytes

Hi @anaconda777

I have replicated the issue on drupal 11
When editing a conditional dependency, if Custom jQuery selector for control field (under Advanced edit context settings) was previously saved, clearing the field and saving did not remove the value. Re-opening the edit form still showed the old selector.

Cause
In ConditionalFieldEditForm::submitForm(), empty form values are skipped:

if (in_array($key, $exclude_fields) || empty($value)) {
continue;
}
Because $settings is a reference to the existing stored settings, skipping an empty selector value leaves the previous value in place.

Fix
When the selector field is empty on save, we now explicitly save it as blank.

Provided the patch for the same, Please review once