Literal "_none" value saved for seelct fields

Created on 4 December 2024, about 2 months ago

Problem/Motivation

#3384140 introduced a regression of sorts; filtering in the NameWidget uses array_search() only returns the first key:

If needle is found in haystack more than once, the first matching key is returned. To return the keys for all matching values, use array_keys() with the optional filter_value parameter instead.

https://www.php.net/manual/en/function.array-search.php

So, if we have both title and generational in the form and the user leaves both blank, only one of these is going to get massaged to remove the "_none".

Steps to reproduce

Use a name field with multiple selects (e.g. title, generational) and leave both unassigned. When saving, only one of the values will be massaged and the other will have the literal "_none" persisted to the database.

Proposed resolution

Proposed patch attached

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States tkiehne

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024