summaryrefslogtreecommitdiffstats
path: root/install/ui/add.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-10-25 18:41:45 -0500
committerEndi S. Dewata <edewata@redhat.com>2011-10-27 13:48:51 +0000
commit7142cee430a194cca1208ce4ebcd70ee892af1b9 (patch)
treeb5850c550433b1105bb9fefcb46bb1d9011c8c6a /install/ui/add.js
parent725e2e46248ee9ab3dae9a523fcd6fda0bd0cff3 (diff)
downloadfreeipa.git-7142cee430a194cca1208ce4ebcd70ee892af1b9.tar.gz
freeipa.git-7142cee430a194cca1208ce4ebcd70ee892af1b9.tar.xz
freeipa.git-7142cee430a194cca1208ce4ebcd70ee892af1b9.zip
Refactored validation code.
The validation code in details facet, dialog, and sections have been modified to work more consistently.
Diffstat (limited to 'install/ui/add.js')
-rw-r--r--install/ui/add.js18
1 files changed, 3 insertions, 15 deletions
diff --git a/install/ui/add.js b/install/ui/add.js
index 65b7711e..621861fd 100644
--- a/install/ui/add.js
+++ b/install/ui/add.js
@@ -124,25 +124,15 @@ IPA.entity_adder_dialog = function(spec) {
command.add_args(that.entity.get_primary_key_prefix());
+ if (!that.validate()) return;
+
var record = {};
that.save(record);
- var fields = that.get_fields();
- for (var i=0; i<fields.length; i++) {
- fields[i].validate();
- }
-
- var valid = true;
-
var sections = that.sections.values;
- for (i=0; i<sections.length; i++) {
+ for (var i=0; i<sections.length; i++) {
var section = sections[i];
- if (!section.is_valid() || !valid) {
- valid = false;
- continue;
- }
-
var section_fields = section.fields.values;
for (var j=0; j<section_fields.length; j++) {
var field = section_fields[j];
@@ -162,8 +152,6 @@ IPA.entity_adder_dialog = function(spec) {
}
}
- if (!valid) return;
-
//alert(JSON.stringify(command.to_json()));
if (that.pre_execute_hook) {