Support community for TTG plugins and products.
NOTICE
The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.
This forum is now closed, and exists here as a read-only archive.
You are not logged in.
Pages: 1
When clicking on the search icon in the navigation menu bar, the search text box is shown as expected. However, the search text box isn't in focus and isn't ready to accept text input - This is confusing for my users. While user testing, all of them first try typing a search term when presented with the text box, and those who weren't touch-typists, looked down and started typing, completing the word without realizing their text was getting lost.
It would be super helpful if the cursor is at the search text box is immediately ready to accept text input, without requiring the user the extra step of moving their mouse cursor to the search text box and clicking the mouse button.
Thanks!
Offline
try placing this in a phplugins file and then use that phplugins file in the page template that controls the album template for your search page (under Advanced Customization):
/*Place focus on form input field
=========================================*/
function ttg_scripts ( $style, $path ) {
echo'
<script>
window.onload = function() {
document.getElementById("q").focus();
}
</script>
';
} //END
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Works as advertised. I placed the above code in the user section of my phplugins.php file. Things have moved a bit since I last tried this, CE4.
There is a sample php file in .../backlight/custom/phplugins and it contains several sample functions all of which are inactive. I placed this function at the end. Location of the file is important for Backlight to be able to find it.
Then I renamed it to phplugins.php. This is important to prevent an inadvertent file overwrite with an update where Matt has traditionally updated only the phplugins-sample.php file.
I then went to my default page template and activated phplugins and selected my modified puplugins.php file.
I then made sure my browser reloaded the pages and now the focus is indeed in the text entry field.
I then tested in Chrome, IE, Edge and FireFox - seems to work and no unusual behavior noted elsewhere in the site.
Jim.
Last edited by jherman (2016-11-15 21:25:01)
User with too little time but coding is therapeutic.
Offline
Apparently the code above can throw a console error. See this for something better:
http://community.theturninggate.net/vie … 866#p43866
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Pages: 1