p:commandButton onclick submit - not working

UI Components for JSF
Post Reply
helloprimefaces
Posts: 56
Joined: 28 Sep 2009, 17:44

12 Feb 2011, 02:23

Hi,
p:commandButton with onclick JS returning "false" always submits the form (via Ajax).
I expected that commandButton should submit the form only if onclick returns "true".
Also, if i use onlick="return test();", then regardless of anything it submits the whole form (full refresh).
Version: PF 2.2 , JSF 2.0, Tomcat 7
Code:

Code: Select all

<p:commandButton onlick="test();" actionListener="#{loginBean.login}" />

<script type="text/javascript">
			function test() {
				 return false;
			}
		</script> 
Please help me.

Thanks.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

12 Feb 2011, 10:57

Try onstart.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests