summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-05-28 13:24:54 +0200
committerPetr Vobornik <pvoborni@redhat.com>2012-06-04 11:26:47 +0200
commit7d9abecbb6b2779e074616ca5563714d165bb49b (patch)
tree28b1e0f0747493186a73c427436964dcd41d88a7 /install
parent664d33cef6304c834ab0225a018b1de0f154e58d (diff)
downloadfreeipa-7d9abecbb6b2779e074616ca5563714d165bb49b.tar.gz
freeipa-7d9abecbb6b2779e074616ca5563714d165bb49b.tar.xz
freeipa-7d9abecbb6b2779e074616ca5563714d165bb49b.zip
Text widget's dirty state is changed on various input methods
on_value_changed event in textboxes and textareas was raised only on keyboard input. If user used different input method such as paste or browser undo and redo functions widget's on_value_changed event wasn't raised and so dirty state wasn't changed as well. This patch adds listener to text's and textarea's 'input' event. Input is a HTML 5 event which is raises on user initiated action. Some of user initiated actions : * Cut * Copy * Paste * Undo * Redo * Clear * Typing (like keyup) * Form AutoFill * User-invoked spellcheck corrections * Input from Input Method Editor It should be supported by all recent versions of major browsers. IE doesn't support it up to version 8. Listener for 'keyup' event was left in implementation for backward compatibility with older browsers. This may cause firing on_value_change twice but so far it shouldn't cause troubles. https://fedorahosted.org/freeipa/ticket/2647
Diffstat (limited to 'install')
-rw-r--r--install/ui/widget.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js
index e7a837f99..d3dbd4c37 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -193,6 +193,11 @@ IPA.input_widget = function(spec) {
}
};
+ that.on_value_changed = function() {
+ var value = that.save();
+ that.value_changed.notify([value], that);
+ };
+
that.focus_input = function() {};
that.set_deleted = function() {};
@@ -249,10 +254,14 @@ IPA.text_widget = function(spec) {
size: that.size,
title: that.tooltip,
keyup: function() {
- that.value_changed.notify([], that);
+ that.on_value_changed();
}
}).appendTo(container);
+ that.input.bind('input', function() {
+ that.on_value_changed();
+ });
+
if (that.undo) {
that.create_undo(container);
}
@@ -970,10 +979,14 @@ IPA.textarea_widget = function (spec) {
disabled: that.disabled,
title: that.tooltip,
keyup: function() {
- that.value_changed.notify([], that);
+ that.on_value_changed();
}
}).appendTo(container);
+ that.input.bind('input', function() {
+ that.on_value_changed();
+ });
+
if (that.undo) {
that.create_undo(container);
}
@@ -2128,6 +2141,10 @@ IPA.combobox_widget = function(spec) {
}
}).appendTo(that.input_container);
+ that.input.bind('input', function() {
+ that.input_field_changed.notify([], that);
+ });
+
that.open_button = IPA.action_button({
name: 'open',
icon: 'combobox-icon',