Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions api/src/org/labkey/api/data/DataColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,19 @@ private void renderSelectFormInput(HtmlWriter out, String formFieldName, Object

out.write(select.addOptions(options));

/*
* GitHub Issue 1076: Clearing a MVTC value in the SDMS UI is confusing
* Multi-selects are weird. If no options are selected they don't post at all, so it's impossible to tell
* the difference between values that weren't on the html form at all and ones that were cleared by the user.
*
* To fix this, each multiple-select posts a hidden field with the same name and an empty value,
* ensuring the field is always present in the POST body.
*/
if (isMultiple && !_boundColumn.isRequired())
out.write(InputBuilder.hidden()
.name(formFieldName)
.value(""));

// disabled inputs are not posted with the form, so we output a hidden form element:
if (disabledInput)
renderHiddenFormInput(out, formFieldName, value);
Expand Down
Loading