summaryrefslogtreecommitdiffstats
path: root/install/ui/widget.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-01-23 07:41:10 +0700
committerAdam Young <ayoung@redhat.com>2011-01-26 16:42:55 -0500
commitadd7d701c688be4d9699034427e5ab1be67a8bac (patch)
treebc508017c5539ab103acd86925e9c46d66fcc356 /install/ui/widget.js
parent5ca58d58b3563e9e275aa9eda2951e1123377dbd (diff)
downloadfreeipa-add7d701c688be4d9699034427e5ab1be67a8bac.tar.gz
freeipa-add7d701c688be4d9699034427e5ab1be67a8bac.tar.xz
freeipa-add7d701c688be4d9699034427e5ab1be67a8bac.zip
Check field's validity before executing add.
Diffstat (limited to 'install/ui/widget.js')
-rw-r--r--install/ui/widget.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 90f6dac8b..f34532d23 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -46,6 +46,7 @@ IPA.widget = function(spec) {
that.save = spec.save || save;
that.update = spec.update || update;
that.validate_input = spec.validate_input || validate_input;
+ that.valid = true;
that.param_info = spec.param_info;
that.__defineGetter__("entity_name", function(){
@@ -61,23 +62,25 @@ IPA.widget = function(spec) {
displays the error message and returns false. */
function validate_input(text) {
if (!(that.param_info && that.param_info.pattern)) {
- return true;
+ that.valid = true;
+ return;
}
var error_link = that.get_error_link();
if (!error_link) {
- return true;
+ that.valid = true;
+ return;
}
var regex = new RegExp( that.param_info.pattern );
//If the field is empty, don't validate
if ( !text || text.match(regex) ) {
error_link.css('display', 'none');
- return true;
+ that.valid = true;
}else{
error_link.css('display', 'block');
if (that.param_info.pattern_errmsg) {
error_link.html(that.param_info.pattern_errmsg);
}
- return false;
+ that.valid = false;
}
}