3.0 beta 2

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
January 12,
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
January 13,
Anand, I don't see what's different in code you posted?
Dmitry
January 13,
Sir
If possible Please Help me
how to drag listbox items within the same listbbox(to move up and down).

Thanks a lot.
Anand
January 13,
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
January 13,
Anand, how many times are you going to post your question? It only needs to be done once!
Jim Hunter
January 13,
that Anand guy totally highjacked this thread, but would still like to get an answer if anyone has one? :)
Dmitry
January 15,
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
January 15,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.