Skip to content

Commit

Permalink
Tries to improve the usability of CTK.Submitter. The 'Enter' handling
Browse files Browse the repository at this point in the history
was not working as expected. This patch improves the situation.

git-svn-id: svn://cherokee-project.com/CTK/trunk@5554 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Sep 25, 2010
1 parent abd9e3f commit e8345a7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions static/js/Submitter.js
Expand Up @@ -43,6 +43,12 @@ if ((typeof submitter_loaded) == 'undefined') {
key_pressed = true;
};

function input_keypress_noauto_cb (event) {
if (event.keyCode == 13) {
submit_form();
}
};

function input_blur_cb (event) {
/* Only proceed when something */
if (! key_pressed) {
Expand Down Expand Up @@ -208,6 +214,7 @@ if ((typeof submitter_loaded) == 'undefined') {
this.init = function (self) {
/* Events */
self.find(":text, :password, textarea").not('.noauto').bind ('keypress', self, input_keypress_cb);
self.find(":text, :password, textarea").filter('.noauto').bind ('keypress', self, input_keypress_noauto_cb);
self.find(":text, :password, textarea").not('.noauto').bind ("blur", self, input_blur_cb);
self.find(":checkbox, :radio").not('.required,.noauto').bind ("change", self, input_checkbox_cb);
self.find("select").not('.required,.noauto').bind ("change", self, input_combobox_cb);
Expand Down

0 comments on commit e8345a7

Please sign in to comment.