$('myform').focusFirstElement()
Strangely, it does not work in Firefox 2.0. It complains that
focusFirstElement is not a function. Firebug tells me that
HTMLFormElement.prototype.focusFirstElement indeed is a function. I
can't say I understand what's happening here.
Michael
--
Michael Schuerig
mailto:mic...@schuerig.de
http://www.schuerig.de/michael/
Well, select is not broken and neither is focusFirstElement().
Unfortunately, in my concrete case it is. I'll have to find out and
when it's something interesting or very dumb on my part, I'll follow
up.
The function in Prototype.js should provide a hint:
focusFirstElement: function(form) { ... }
Which indicates it requires a form as an argument. Try:
focusFirstElement('myform');
Which works in Firefox but fails in Safari. You might prefer the much
more widely supported:
document.forms['myform'].elements[0].focus();
or, if the form's name is myform you can use the shorter:
document.myform.elements[0].focus();
--
Rob
Nope. The functions in Form.Methods are mixed into
HTMLFormElement.prototype, where possible, otherwise they are added to
each form accessed through $('myform'). Therefore
$('myform').focusFirstElement()
does indeed work. That it didn't work for me originally was due to some
braindeadness on my part. Let's say when 'myform' is really the id of a
form element, then it does work at least in Firefox, Konqueror, and
IE7.