单击primefaces中的单选按钮后无法显示文本框

时间:2014-12-18 06:08:35

标签: jsf primefaces

单击单选按钮后,我无法显示隐藏框...我还附加了我使用该功能的代码...

代码:

<p:tab id="details" title="Company" titleStyleClass="tab" >
    <p:panel header="Details of the Applicant">
        <p:messages />
        <h:panelGrid border="0" columns="3" cellpadding="4" columnClasses="control-label">

            <h:outputText   value="#{msg['personal.applied']}"/>
            <p:selectOneRadio id="console" value="#{bean.applied}" >
                <f:selectItem itemLabel="Yes" itemValue="yes" />
                <f:selectItem itemLabel="No" itemValue="no" />
                <f:ajax process="console"   update="details" />
            </p:selectOneRadio>
            <p:spacer></p:spacer>

            <h:outputLabel  value="#{msg['personal.personName']}" rendered="#{bean.applied eq 'no'}"></h:outputLabel>
            <p:inputText id="personName"    value="#{bean.personName}"   rendered="#{bean.applied eq 'no'}"/>
            <p:watermark for="personName" value=" Favour is Sought " id="watermark2" />

            <h:outputText   value="# msg['personal.personName']} " rendered="#{bean.applied eq 'no'}"/>
            <p:inputText id="personName" value="#{bean.personName}"  label="PersonName"  rendered="#{bean.applied eq 'no'}" />
            <p:watermark for="PersonName" value="Applicant " id="watermark3" />
        </h:panelGrid>
    </p:panel>
</p:tab>

请有人帮我解决问题....

1 个答案:

答案 0 :(得分:1)

由于没有附加渲染器,因此无法单独更新<p:tab ..>

但是,您可以更新<p:tabview ..>元素或(我更喜欢)定位<p:panel ...>以进行更新。

这应该有效:

<p:tab id="details" title="Company" titleStyleClass="tab" >
    <p:panel id="panelIdForDemonstration" header="Details of the Applicant">
        <p:messages />
        <h:panelGrid border="0" columns="3" cellpadding="4" columnClasses="control-label">

            <h:outputText   value="#{msg['personal.applied']}"/>
            <p:selectOneRadio id="console" value="#{bean.applied}" >
                <f:selectItem itemLabel="Yes" itemValue="yes" />
                <f:selectItem itemLabel="No" itemValue="no" />
                <f:ajax process="console"   update="panelIdForDemonstration" />
            </p:selectOneRadio>
            <p:spacer></p:spacer>

            <h:outputLabel  value="#{msg['personal.personName']}" rendered="#{bean.applied eq 'no'}"></h:outputLabel>
            <p:inputText id="personName"    value="#{bean.personName}"   rendered="#{bean.applied eq 'no'}"/>
            <p:watermark for="personName" value=" Favour is Sought " id="watermark2" />

            <h:outputText   value="# msg['personal.personName']} " rendered="#{bean.applied eq 'no'}"/>
            <p:inputText id="personName" value="#{bean.personName}"  label="PersonName"  rendered="#{bean.applied eq 'no'}" />
            <p:watermark for="PersonName" value="Applicant " id="watermark3" />
        </h:panelGrid>
    </p:panel>
</p:tab>