Fixed a problem with priming using a request other than ajax

I use a primer in the inplace editor. (proven prime 3.2, 3.3, 3.4RC1 and 3.4 snapshot)

When the form is sent through the request without an ajax, and the other required field in the form is not filled out, the page should reload and show the required message. But in fact, the following happens: Along with reloading the page and requireMessage, the inplace editor is already displayed. How to solve this problem?

Sample code to reproduce the problem

<h:form prependId="false">
    <p:inplace editor="true" widgetVar="X">
        <p:inputTextarea value="#{smsAlertBean.alertText}" />
    </p:inplace>
</h:form>
<h:form prependId="false">
    <p:selectOneMenu required="true" requiredMessage="Please select">
                <!-- your values -->
    </p:selectOneMenu>
    <p:commandButton value="Submit" action="#{smsAlertBean.dummyAction}" ajax="false" />
</h:form>
+2
source share
1 answer

I bet this is a mistake <p:inplace>. From the method InplaceRenderer#encodeMarkup():

boolean validationFailed = context.isValidationFailed();
String displayStyle = validationFailed ? "none" : "inline";
String contentStyle = validationFailed ? "inline" : "none";

, "" , . , PrimeFaces, / .

, inplace JavaScript widgetVar. cancel(), .

<p:commandButton binding="#{foo}" value="Submit" action="#{smsAlertBean.dummyAction}" ajax="false" />
<h:outputScript rendered="#{param.containsKey(foo.clientId)}">X.cancel();</h:outputScript>

( script, , )

, , /. inplace . PrimeFaces, InplaceRenderer , .

+3

All Articles