使用渲染属性更新组件不起作用

时间:2014-03-19 10:27:15

标签: jsf primefaces

我有一个电子邮件输入,我想验证它并显示一个图标是否正确。我使用带有模糊事件的p:ajax。但是具有渲染属性的属性不起作用。 我使用primefaces 4.0和jsf 2.2。 以下是https://www.dropbox.com/s/4yi2246wzqgymcr/before.JPG之前和https://www.dropbox.com/s/5bii3bv145s99ge/after.JPG

之后的图片
                <p:row>
                    <p:column style="width:400px">
                        <h:outputLabel for="inpTextRegEmail" styleClass="outputRight" value="#{msg['regi_mail']}" />
                    </p:column>
                    <p:column style="width:30px">
                        <h:outputText styleClass="requiredIcon" value="∗" />
                    </p:column>
                    <p:column style="width:350px">
                        <p:inputText style="width:350px" id="inpTextRegEmail" value="#{regiBean.user.EMAIL}"
                            required="true" maxlength="75">
                            <f:validator immediate="true" validatorId="at.dccs.csm.gui.jsf.validator.emailValidator" />
                            <p:ajax event="blur" process="@this"
                                update="correctMail   correctMailIcon incorrectMailIcon  emailMSG hiasl" />
                        </p:inputText>
                    </p:column>

                    <p:column style="width:410px">
                        <h:panelGroup id="mailTip" class="fa fa-question-circle fa-2x" />
                        <p:tooltip for="mailTip" value="Some Help" />
                        <p:message id="emailMSG" for="inpTextRegEmail" />
                    </p:column>
                </p:row>
                <p:row>

                    <p:column style="width:400px">
                        <p:outputLabel styleClass="outputRight" value="Username" />
                    </p:column>
                    <p:column style="width:30px">
                        <p:outputLabel styleClass="requiredIcon" value=" " />
                    </p:column>

                    <p:column>
                        <p:outputLabel id="correctMail" style="color: green;" value="#{regiBean.user.EMAIL}" />
                    </p:column>

                    <p:column>
                        <h:panelGroup id="correctMailIcon" class="fa fa-check-circle  fa-2x"
                            rendered="#{regiBean.correctUsername == true}" />
                        <h:panelGroup id="incorrectMailIcon" class="fa fa-minus-square fa-2x"
                            rendered="#{regiBean.correctUsername == false}" />
                    </p:column>
                </p:row>

1 个答案:

答案 0 :(得分:0)

blur事件不是事件。它必须与<p:inputText />组件事件相关。

onblur组件中使用<p:ajax />事件进行事件触发。 <p:inputText />支持的事件为onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect。在<p:ajax />组件的事件属性中使用这些属性中的任何一个。

使用以下代码更新组件

<p:ajax event="onblur" process="@this"
     update="correctMail   correctMailIcon incorrectMailIcon  emailMSG hiasl" />

将光标放在primefaces组件之间,然后点击Ctrl + Space显示属性列表,事件名称以 On 开头,如onblur... etc

相关问题