From 7142cee430a194cca1208ce4ebcd70ee892af1b9 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Tue, 25 Oct 2011 18:41:45 -0500 Subject: [PATCH] Refactored validation code. The validation code in details facet, dialog, and sections have been modified to work more consistently. --- install/ui/add.js | 18 +++------------- install/ui/details.js | 50 ++++++++++++++++++++----------------------- install/ui/dialog.js | 13 +++++------ install/ui/entitle.js | 2 +- install/ui/user.js | 2 ++ install/ui/widget.js | 2 +- 6 files changed, 37 insertions(+), 50 deletions(-) diff --git a/install/ui/add.js b/install/ui/add.js index 65b7711e2..621861fd6 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', { href: 'jslink', title: 'userpassword', diff --git a/install/ui/widget.js b/install/ui/widget.js index 948e6fd52..7f2260c73 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -118,7 +118,7 @@ IPA.widget = function(spec) { } }; - that.check_required = function() { + that.validate_required = function() { var values = that.save(); if (!values || !values.length || values[0] === '') { if (that.is_required()) {