This is probably a general HTML question, but I’ll ask it here anyway.
Is there any way to set the focus to a specific field in a form
generated in
a view? The little I’ve found on so far suggests that I need to add
some
javascript to do this. I can go figure out how to do that, but it seems
like it should be the sort of thing that could already be built into
Rails.
this one requires prototype (for textfield with id “searchtext”):
Does that work for you in Internet Explorer? It didn’t for me. I’m
currently using a partial to hold my form-focus JavaScript and I pass
it the ID of the field I require focus for.
#/views/shared/_form_focus.html.erb
Then I call that in a view (in this example to pass focus to the field
with id first_name):
Does that work for you in Internet Explorer? It didn’t for me. I’m
currently using a partial to hold my form-focus JavaScript and I pass
it the ID of the field I require focus for.
Sorry, can’t say for sure. At least not after reading the thread you
linked.
If I got this right, the problem you mention happens only, if some
other
javascript (like alert) is executed same time.
And remember, kids, it's never too late to pick up bad habits. :-)
The "language" attribute of the script tag has been deprecated for,
oh, what, like TEN YEARS now?
Just sayin' ...
--
Hassan S. ------------------------ [email protected]
On Fri, Dec 5, 2008 at 12:09 PM, Hassan S. < [email protected]> wrote:
And remember, kids, it's never too late to pick up bad habits. :-)
The "language" attribute of the script tag has been deprecated for,
oh, what, like TEN YEARS now?
Just sayin' ...
Ok,
As one of the “kids” to whom you refer (albeit a rather old, hairy
“kid”),
what would be the good habit I would want use instead?
what would be the good habit I would want use instead?
Short answer:
Longer answer: read the spec – that is, develop the habit of looking
up the tags you’re using rather than relying on potentially incorrect
or out-of-date online references – http://www.w3.org/TR/html401/
Running your pages through the W3C validator will also point out
problematic markup, and frequently prevent a lot of styling and JS
headaches.