summaryrefslogtreecommitdiffstats
path: root/install/ui/field.js
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-01-02 16:41:04 +0100
committerEndi S. Dewata <edewata@redhat.com>2012-01-03 21:28:45 -0600
commit911f396604f1fe3f45b5cc40e3885a975d07fa91 (patch)
tree800247c77a1e0e31ab026fadc38fcb7c5764c9d4 /install/ui/field.js
parent747c069c4579277393349c5f1f1589efb784118a (diff)
downloadfreeipa-911f396604f1fe3f45b5cc40e3885a975d07fa91.tar.gz
freeipa-911f396604f1fe3f45b5cc40e3885a975d07fa91.tar.xz
freeipa-911f396604f1fe3f45b5cc40e3885a975d07fa91.zip
Added validation logic to multivalued text field
https://fedorahosted.org/freeipa/ticket/1466
Diffstat (limited to 'install/ui/field.js')
-rw-r--r--install/ui/field.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/install/ui/field.js b/install/ui/field.js
index fc6b75dda..8db0c87cb 100644
--- a/install/ui/field.js
+++ b/install/ui/field.js
@@ -522,7 +522,35 @@ IPA.multivalued_field = function(spec) {
that.widget_value_changed = function() {
that.set_dirty(that.test_dirty());
- //that.validate(); disabling validation for now
+ that.validate();
+ };
+
+ that.validate = function() {
+
+ that.hide_error();
+ that.valid = true;
+
+ var values = that.save();
+
+ if (that.is_empty(values)) {
+ return that.valid;
+ }
+
+ for (var i=0; i<values.length; i++) {
+
+ for (var j=0; j<that.validators.length; j++) {
+
+ var validation_result = that.validators[j].validate(values[i], that);
+ if (!validation_result.valid) {
+ that.valid = false;
+ var row_index = that.widget.get_saved_value_row_index(i);
+ that.widget.show_child_error(row_index, validation_result.message);
+ break;
+ }
+ }
+ }
+
+ return that.valid;
};
return that;