Well that works for FireFox, but not IE. in IE the event listener is
never triggered so I'm assuming it has trouble propagating the event
handler from the container to the child.
I worked out another solution yesterday though, it's pretty exhaustive
but it works:
1. this function finds the text field which is dynamically created by
the AutoCompleter component:
function getTextField()
{
var elems = document.getElementsByTagName("input");
for(var i = 0; i < elems.length; i++)
{
var elem = elems[i];
if (elem.type == "text" && elem.className == "dojoComboBox")
return elem;
}
return null;
}
2. this procedure attaches the event handler to it, keep in mind this
must be called AFTER ALL onload events handlers are finished:
getTextField().onkeypress = function(event)
{
if (!event)
event = window.event;
if (event.keyCode == 13)
{
dojo.event.browser.stopEvent(event);
return false;
}
};
Far from the preferred solution, but it works.
p.
Andreas Andreou wrote:
I'd connect a key handler somewhere higher at the html hierarchy
(perhaps at the containing div or form level) and do something like:
dojo.event.connect(dojo.byId('container'), 'onkeydown', function(e) {
if (e.keyCode==13) // or use e.target to refine the condition for ENTER trapping
dojo.event.browset.stopEvent(e);
} );
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]