summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-11-26 14:59:25 +0100
committerYorhel <git@yorhel.nl>2008-11-26 14:59:25 +0100
commitd803fc7c69beb6715ce4b5cacfbf1c6385de32ba (patch)
tree4ce264f096462da9d5ee4389b5c8038081e68e4a /static
parent499464bc1618ec9a556c085792fccbd5a7131fa9 (diff)
Added a hack for opera to not submit the form on the return key
Diffstat (limited to 'static')
-rw-r--r--static/f/forms.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/static/f/forms.js b/static/f/forms.js
index 8c09e1e2..02f570ad 100644
--- a/static/f/forms.js
+++ b/static/f/forms.js
@@ -117,16 +117,25 @@ function dsKeyDown(ev) {
// do some processing when the enter key has been pressed
if(c == 13) {
- if(obj.selectedId != 0) {
+ if(obj.selectedId != 0)
obj.value = obj.serFunc(x('ds_box_'+obj.selectedId).itemData);
- x('ds_box').style.top = '-500px';
- obj.selectedId = 0;
- return false;
- } else if(obj.returnFunc) {
+ else if(obj.returnFunc)
obj.returnFunc();
- return false;
+ else
+ return true;
+ x('ds_box').style.top = '-500px';
+ obj.selectedId = 0;
+
+ // opera hack: make sure to not send the form on the return key
+ while(obj && obj.nodeName.toLowerCase() != 'form')
+ obj = obj.parentNode;
+ if(obj) {
+ var oldsubmit = obj.onsubmit;
+ obj.onsubmit = function() { return false };
+ setTimeout(function() { obj.onsubmit = oldsubmit }, 100);
}
- return true;
+
+ return false;
}
// process up/down keys