Hello everybody.
Is there a way to "click" a <p:commandButton> using JavaScript? The User's Guide only lists the enable() and disable() functions for the Client side API.
Thanks in advance for any advice!
Best regards,
Robert
Execute a CommandButton using JavaScript
hi,
instead of clicking the p:commandbutton, you can use remote command maybe.
http://www.primefaces.org/showcase/ui/remoteCommand.jsf
btw I remember with jQuery click(), you can do what you want.
Yigit
instead of clicking the p:commandbutton, you can use remote command maybe.
http://www.primefaces.org/showcase/ui/remoteCommand.jsf
btw I remember with jQuery click(), you can do what you want.
Yigit
I guess something like this should work...
Code: Select all
<p:commandButton id="mybutton" ...
Code: Select all
<script type="text/javascript">
//<![CDATA[
document.getElementById('mybutton').click();
//]]>
</script>
Use
It will work 100%.
Code: Select all
<script type="text/javascript">
jQuery('#mybutton').click();
</script>
PrimeFaces 3.0, Glassfish 3.1.2, Mojarra 2.1.6,
- bumble.bee
- Posts: 723
- Joined: 29 Sep 2010, 21:39
- Location: United States
I'm guessing IE (usually a safe bet!)
I think IE 6 and 7 getElementById searches both element ID and element Name, which can cause conflicts. There may be other issues...
I think IE 6 and 7 getElementById searches both element ID and element Name, which can cause conflicts. There may be other issues...
-
- Information
-
Who is online
Users browsing this forum: No registered users and 36 guests