:: Forum >>

AW.UI.Input in a form

Hi folks,

what's wrong with this code:

SOM.IO.SearchBox = AW.UI.Input.subclass();
SOM.UI.SearchBox.create = function()
{

AW.Templates.Popup.create.call(this);
var obj = this.prototype;

obj.setEvent("onkeypress", function(e) {
var keyCode = e.keyCode?e.keyCode : e.which;

if( keyCode == 13 )
{
e.returnValue = false;
}
})

// [...]
}

I want to be able to put the above control inside of a form, but disable submission when the enter key is pressed. The keypress press event gets processed by the onkeypress handler just fine, but it seems that the event doesn't get canceled and the browser still submits the form. Any suggestions?

Thanks
Dmitry
Dmitry
Thursday, January 12, 2006
SOM.IO.SearchBox = AW.UI.Input.subclass();
SOM.UI.SearchBox.create = function()
{

AW.Templates.Popup.create.call(this);
var obj = this.prototype;

obj.setEvent("onkeypress", function(e) {
var keyCode = e.keyCode?e.keyCode : e.which;

if( keyCode == 13 )
{
e.returnValue = false;
}
})

// [...]
}
Anand
Friday, January 13, 2006
Anand, I don't see what's different in code you posted?
Dmitry
Friday, January 13, 2006
Sir
If possible Please Help me
how to drag listbox items within the same listbbox(to move up and down).

Thanks a lot.
Anand
Friday, January 13, 2006
Sir
If possible Please Help me
how to drag listbox items within the same listbbox(to move up and down).using Javascript.

Thanks a lot.
Anand
Friday, January 13, 2006
Anand, how many times are you going to post your question? It only needs to be done once!
Jim Hunter
Friday, January 13, 2006
that Anand guy totally highjacked this thread, but would still like to get an answer if anyone has one? :)
Dmitry
Sunday, January 15, 2006
Not really sure , but inside the AW.UI.Input there is:
obj.onKeyEnter=function() {
try {
if(this.$owner) {
    this.$owner.element().focus();
this.setTimeout(function() {
    this.$owner.element().focus()
}
    )
}
else {
    this.raiseEvent("update")
}

Try to put some alerts to check if this have priority over your keypress event.
Carlos
Sunday, January 15, 2006

This topic is archived.


Back to support forum

Forum search