Primefaces运行java脚本onComplete / onClick [英] Primefaces run java script onComplete/onClick

查看:120
本文介绍了Primefaces运行java脚本onComplete / onClick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有ap:命令按钮,如下所示。

I have a p:command button as shown below.

<p:commandButton id="settings" ajax="false" onComplete="window.alert('sometext');"      value="#{messages.settings}"
styleClass="cancelButton" style="font-family: sans-serif, Arial, Helvetica, Geneva; font-size: 10pt; width: 90px;" /></td>

我希望这个按钮能够运行java脚本onComplete或onClick但是我无法得到任何一个上班。我实际上想要它打开一个弹出窗口,但在这里我尝试了一个更简单的脚本来做一个警报。但这也不起作用。一切都没有发生。

I want this button to run a java-script onComplete or onClick but I can not get any of them to work. I actually want it to open a popup but here I have tried with an easier script to just do an alert. But this does not work either. Nothing happens at all.

任何人都可以帮助我吗?

Can anyone help me?

推荐答案

第一: onxxx 没有资本(其中xxx是开始 / 完成 / 成功

First : there is no capitals in onxxx (where xxx is start / complete / success)

因为你设置 ajax =false你的按钮不会做任何ajax,这意味着 onstart / oncomplete / onsuccess 将不会在全部

Since you set ajax="false" your button won't do any ajax , which means that onstart / oncomplete / onsuccess won't be triggered at all

使用 onclick =alert('哇')

如果您要删除 ajax =false,您将可以使用 oncomplete =alert('wow')

If you will remove the ajax="false" you will be able to use oncomplete="alert('wow')"

这篇关于Primefaces运行java脚本onComplete / onClick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆