Javascript Primefaces RadioButton,JS函数不工作
我对xhtml文件中的3个单选按钮有一个问题,当我单击一个单选按钮调用onclick JS函数时,它第一次进入函数,但下次我将单击同一个按钮或另一个按钮,该函数将不会执行。 页面重新加载时选择的单选按钮将正确执行该函数,但当我选择另一个按钮,然后返回到第一个或第三个按钮时,JS函数将不会执行 下面是xhtml代码的一小部分:Javascript Primefaces RadioButton,JS函数不工作,javascript,primefaces,xhtml,Javascript,Primefaces,Xhtml,我对xhtml文件中的3个单选按钮有一个问题,当我单击一个单选按钮调用onclick JS函数时,它第一次进入函数,但下次我将单击同一个按钮或另一个按钮,该函数将不会执行。 页面重新加载时选择的单选按钮将正确执行该函数,但当我选择另一个按钮,然后返回到第一个或第三个按钮时,JS函数将不会执行 下面是xhtml代码的一小部分: <ui:component xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http:/
<ui:component xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.org/seam/faces"
xmlns:p="http://primefaces.org/ui">
<p:outputPanel id="identificationMethod">
<p:selectOneRadio id="identificationMethodRadio"
validator="required"
requiredMessage="SELECT CONFIRMATION METHOD"
layout="custom"
value="#{identificationMethodSelector.identificationMethod}">
<p:ajax update="identificationMethod" global="false"/>
<f:selectItems value="#{identificationMethodSelector.identificationMethodList}" />
</p:selectOneRadio>
<ui:fragment rendered="#{!hideIdentificationMethodNone and user.enableIdentificationMethodNone}">
<div>
<p:radioButton id="identificationMethodNone" for="identificationMethodRadio" itemIndex="5" />
<h:outputLabel for="identificationMethodNone"
value="NOT NOW" />
<ui:fragment rendered="true">
<div class="identificationMessage">
<div class="spacer" />
<span>xxxxxxxxx</span><br />
<div class="spacer" />
</div>
</ui:fragment>
</div>
</ui:fragment>
正如你所看到的,JS没有问题,我认为,非常简单的JS,在另一个simbple html文件上尝试过,并且工作正常
在尝试大量思考时,我发现删除这行代码后,JS函数将正常工作:
<p:ajax update="identificationMethod" global="false"/>
但删除这一行会导致其他问题。
如何在不编辑太多XHTML代码的情况下修复此问题?
谢谢单击后,由于
,整个面板标识方法将更新。您必须重新安装onclick处理程序或更新较小的部分。尝试将javascript代码放在更新的面板中,或者更动态地注册EventHandler
<p:ajax update="identificationMethod" global="false"/>