Translate string to array for multi fields in getControlsState (#5057)

* Translate string to array for multi fields in getControlsState

* Updating format to fit on one line
This commit is contained in:
michellethomas 2018-05-23 22:30:44 -07:00 committed by Maxime Beauchemin
parent 05061a73ce
commit 1aaa73b548
1 changed files with 3 additions and 0 deletions

View File

@ -56,6 +56,9 @@ export function getControlsState(state, form_data) {
delete control.mapStateToProps;
}
formData[k] = (control.multi && formData[k] && !Array.isArray(formData[k])) ? [formData[k]]
: formData[k];
// If the value is not valid anymore based on choices, clear it
if (control.type === 'SelectControl' && control.choices && k !== 'datasource' && formData[k]) {
const choiceValues = control.choices.map(c => c[0]);