Chris Abad wrote:
If none of the previous suggestions help, it may also be useful to pastie your js function.

The prior suggestions solved the initial trouble (IE seeming to
intercept the <return> key and submit the form anyway), but I
ran into more IE vs Firefox misbehavior down the road.  It may
be a simple problem, I don't claim to know what I'm doing when
it comes to javascript :-)  In the end, I pretty
much had to punt due to time constraints.  However, the js
is (childNodes commented part failed on one of the browsers,
I forgot which):

function makeEnterLikeTab(elem, event){
    var nextIndex = Number.MAX_VALUE;
    var index = 0;
    if(event.keyCode == 13){
        var current = elem.tabIndex;

        // probably really want to just get nodes for this form, not
        // entire doc.  Something like elem.parentNode.childNodes ?
        formFields = document.getElementsByTagName("input");
        for(i=0;i<formFields.length;i++){
            if(formFields[i].nodeType == 1){
                var tabIndex = formFields[i].getAttribute("tabindex");
                tabIndex = parseInt(tabIndex);
                if((tabIndex < nextIndex) && (tabIndex > current)){
                    nextIndex = tabIndex;
                    index = i;
                }
            }
        }
        formFields[index].setAttribute('autocomplete', 'off');
        formFields[index].focus();
        event.preventDefault();
        event.stopPropagation();
        return false;
    }
}


And it is called on each applicable form element like this:

  :onKeyPress => "makeEnterLikeTab(this, event);"

Thanks all.

        -glenn


On Jun 8, 2007, at 1:40 PM, Michael Genereux wrote:

Replace the <input type=submit> with a <button>.


------------------------------------------------------------------------

_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to