make selects work with ng required

This commit is contained in:
John Mitchell
2018-04-26 17:06:20 -04:00
parent 3bcc48402c
commit f99792e604
2 changed files with 3 additions and 2 deletions

View File

@@ -49,7 +49,8 @@ function BaseInputController (strings) {
scope.state._touched = true; scope.state._touched = true;
} }
if (scope.state._required && !scope.state._value && !scope.state._displayValue) { if (scope.state._required && (!scope.state._value || !scope.state._value[0]) &&
!scope.state._displayValue) {
isValid = false; isValid = false;
message = vm.strings.get('message.REQUIRED_INPUT_MISSING'); message = vm.strings.get('message.REQUIRED_INPUT_MISSING');
} else if (scope.state._validate) { } else if (scope.state._validate) {

View File

@@ -2,7 +2,7 @@ let Base;
function createFormSchema (method, config) { function createFormSchema (method, config) {
function mungeSelectFromOptions (configObj, value) { function mungeSelectFromOptions (configObj, value) {
configObj.choices = [['', '']].concat(configObj.choices); configObj.choices = [[null, '']].concat(configObj.choices);
configObj._data = configObj.choices; configObj._data = configObj.choices;
configObj._exp = 'choice[1] for choice in state._data'; configObj._exp = 'choice[1] for choice in state._data';
configObj._format = 'selectFromOptions'; configObj._format = 'selectFromOptions';