This topic is locked

Advanced Search - Press Enter Key to Search

6/23/2020 7:10:33 AM
PHPRunner General questions
G
Galco author

I am sure the answer is straight forward, but I am scratching my head.
Using 10.4.

On the Advanced Search page, I want the users to be able to press Enter key to search rather than having to mouse click on the Search Button.
I have looked at the following for inspiration:

https://asprunner.com/forums/topic/17390-how-to-use-enteresc-key-to-savecancel/

https://asprunner.com/forums/topic/26524-want-to-use-enter-instead-of-save-button-add-record/

https://asprunner.com/forums/topic/20413-barcode-scanning-into-field/
I have tried adding each of the following to Javascript Onload event for the search page.



$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("input[id^='searchButton1']").trigger('click');

}

});


$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("a[id^='#searchButton1']").trigger('click');

}

});


$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("#searchButton1").trigger('click');

}

});


Inspecting element shows:



<span data-itemtype="search_search" data-itemid="search_search" data-pageid="1" data-small="" data-button-item="">

<a type="button" title="" class="btn btn-primary btn-lg

" id="searchButton1">

Search </a>

</span>


What am I missing?

HJB 6/23/2020

PHPRUNNER 10.4 - Section MISC, check the 508 compatibility box.
https://xlinesoft.com/phprunner/docs/miscellaneous_settings.htm - Additionally available keystrokes apart 508 standard
Section 508 compatibility
Select this checkbox to make the project accessible to a wide range of people with disabilities. For more information, visit http://www.section508.gov/.
Additionally, there are keyboard hotkeys available as described below:
•ALT+E - inline edit current record;
•ALT+S - save current record;
•ALT+C - cancel inline edit;
•ALT+F - go to the advanced search;
•ALT+M - jump to the menu;
•CTRL+left arrow - previous page;
•CTRL+right arrow - next page.
You can also use the keyboard to navigate through the table links on the List page. Press Arrow Up, Arrow Down, Tab, Shift+Tab to switch between the elements.

G
Galco author 6/26/2020

Thanks Walk2fly, but I can't see how that helps.
I have turned on Section 508 compatibility, but I am still unable to press enter to search rather than having to click on the Search button.
Any further suggestions?
It works with the Quick search panel - so why not the Advanced Search?
Paul

Admin 6/26/2020

The last code example works for me after I add it to the Advanced Search page Javascript OnLoad event.

$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("#searchButton1").trigger('click');

}

});


The first example doesn't work because this is an a tag and not an input.

The second example doesn't work because the ID of the element is searchButton1 and not #searchButton1.