I created a search field (id: searchField) and a search button (id: searchButton) using Xpages user controls. I added the onkeypress event to the search field so that it triggered a click on searchButton. Then, SearchButton will reload the page, but with the url parameters coming from the search field. The problem is that the page reloads, but the search parameters are not added to the URL when I press ENTER in the search field , but it works correctly when I click the search button. Here are the codes I used:
(code added to onkeypress searchField)
if (typeof thisEvent == 'undefined' && window.event) {thisEvent = window.event; }
if (thisEvent.keyCode == 13)
{
document.getElementById ("# {id: searchButton}"). click ();
}
(code added to onclick searchButton)
window.location.href = "test.xsp? search =" + document.getElementById ("# {id: searchField}"). value;
I tested it in IE and Firefox, both have problems. I created a sample HTML file and it worked correctly. Is this an XPages error, or am I missing something?
Jairo source
share