From e4d2a842be230516aaebff0ec34ee1707b3fcd03 Mon Sep 17 00:00:00 2001
From: Adam Young ayo...@redhat.com
Date: Mon, 27 Jun 2011 15:57:40 -0400
Subject: [PATCH] validate required fields
https://fedorahosted.org/freeipa/ticket/1329
overides required with optional.
---
install/ui/add.js|4
install/ui/widget.js |8
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/install/ui/add.js b/install/ui/add.js
index eb4484346ae1f8c7743431b822cb20910ac9c60f..50b6124c094c60f18c32897da603331db8c6a161 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; ifields.length; i++) {
+fields[i].validate();
+}
+
+for (i=0; ifields.length; i++) {
field = fields[i];
if (!field.valid) return;
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 38826ee9d64515a8fd88604e2fcf2812ca314f91..344d701c2a72bb11307d0bd4b3f2cb7f3ca268bd 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;
}
--
1.7.5.2
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel