Page 1 of 1

search module -- can you set focus when entering search box?

Posted: Fri Oct 20, 2006 3:00 pm
by i5n
Hi all,

Just a minor issue, I know, but I wondered if anyone else finds it annoying that you have to manually select the text in the Search box to enter your search text?  I was thinking there's a "focus" method for a textbox that automatically selects the contents of the box...is it possible to use that?

I tested this in both IE6 on XP and Firefox on XP and Linux, and it acts the same.  Anyone know of a quick fix for this?

Thanks in advance,
Eric Imboden (i5n)

Re: search module -- can you set focus when entering search box?

Posted: Sat Oct 21, 2006 12:15 am
by 3dc
hi,

quick n dirty-version:

in the template you use

after

Code: Select all

   <div id="search">
          {search}
   </div>
add this:

Code: Select all

<__script__ type="text/javascript">
document.forms[0].cntnt01searchinput.focus();
document.forms[0].cntnt01searchinput.select();
</__script>
I also tried , but somehow it didnt work. I was reading a few webpages which said it has something to do with the order of the forms in the html. I also dont know the magic behind the ids - like "cnt01"(for example, look at /modules/Search/action.default.php)... but the above example should work... quickndirty as i said.

Greetz - ~3DC~