How do I use Javascript to "click" on a CommandButton?
I tried the following but it doesnt work:
<ice:panelTab id="searchResultsTab" label="Search Results" onclick="document.getElementById('form:searchTabs:0:refreshButton').click();">
Thanks.
How do I use Javascript to "click" on a CommandButton?
I tried the following but it doesnt work:
<ice:panelTab id="searchResultsTab" label="Search Results" onclick="document.getElementById('form:searchTabs:0:refreshButton').click();">
Thanks.
Either the element ID is wrong, or the ice:panelTab
itself is doing something during onclick
as well which has overriden your onclick
, or the HTML rendering went bogus (this can happen in one very specific situation) and the onclick
attribute has never been rendered to the response.
To fix the first, doublecheck the page source. To fix the second, check the page source if that is indeed the case and then add a return false;
to end of the onclick
. To fix the third, you'll first need to confirm that the onclick
is indeed not there in the HTML output and then tell more about JSF API and impl versions.
All with all, the answer is in the generated HTML output. It's also the running context of Javascript.