diff options
-rw-r--r-- | install/ui/add.js | 4 | ||||
-rw-r--r-- | install/ui/dialog.js | 2 | ||||
-rw-r--r-- | install/ui/widget.js | 8 |
3 files changed, 12 insertions, 2 deletions
diff --git a/install/ui/add.js b/install/ui/add.js index eb4484346..50b6124c0 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -116,6 +116,10 @@ IPA.add_dialog = function (spec) { var fields = that.fields.values; for (var i=0; i<fields.length; i++) { + fields[i].validate(); + } + + for (i=0; i<fields.length; i++) { field = fields[i]; if (!field.valid) return; diff --git a/install/ui/dialog.js b/install/ui/dialog.js index f4aa71828..4ca38a914 100644 --- a/install/ui/dialog.js +++ b/install/ui/dialog.js @@ -344,8 +344,6 @@ IPA.dialog = function(spec) { var factory = field_spec.factory || IPA.text_widget; field = factory(field_spec); - field.optional = field_spec.optional || false; - /* This is a bit of a hack, and is here to support ACI permissions. The target section is a group of several widgets together. It makes more sense to do them as a diff --git a/install/ui/widget.js b/install/ui/widget.js index 38826ee9d..344d701c2 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -39,6 +39,8 @@ IPA.widget = function(spec) { that.disabled = spec.disabled; that.hidden = spec.hidden; that.conditional = spec.conditional; + that.optional = spec.optional || false; + // read_only is set during initialization that.read_only = spec.read_only; @@ -79,6 +81,12 @@ IPA.widget = function(spec) { var values = that.save(); if (!values || !values.length) { + if (that.param_info && + that.param_info.required && + !that.optional) { + that.valid = false; + that.show_error('required field'); + } return; } |