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

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
i5n

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

Post 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)
3dc

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

Post 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~
Locked

Return to “CMSMS Core”