0

First post here, so bare a bit with me. Searched a lot, but either because I was to blind or because I just didn't use the correct search strings, I haven't found any answer relevant to my problem.

Basically, I have a web application written in Java and using Primefaces. I'm using a p:layout, having the main content in the center unit, the header in the north and the footer in the south unit of the layout. The west layout unit holds a p:poll which runs every two seconds cand calls a js function when the oncomplete event is triggered.

So far so good. The thing is that on a certain page, in the center layout unit, I have a f:viewParam which accepts only longs and, even though the value is valid, when the above poll gets executed, the requiredMessage from the f:viewParam appears.

After doing some intensive search, I've found that by adding a ignoreAutoUpdate="true" to the p:poll, the messages from the f:viewParam will not get triggered and the warning telling that I have to provide a valid id isn't shown.

So, my question is: by having the ignoreAutoUpdate="true" in my p:poll will compromise, by any chance, the f:viewParam validation? Or is it safe to leave it there?

Here is the relevan parts from my layout:

The poll form the west layout unit:

<h:form id="liveQueueForm">
    <p:remoteCommand name="rcStart" action="#{liveQueueMB.startPoll()}"/>
    <p:remoteCommand name="rcStop" action="#{liveQueueMB.stopPoll()}"/>
    <p:poll id="liveQueueUpdater" delay="10" widgetVar="livePoll" interval="2" listener="#{liveQueueMB.init}" oncomplete="updateLiveQueue(xhr, status, args);" autoStart="true" partialSubmit="true" ignoreAutoUpdate="true" immediate="true" />

    <div id="live-queue">
        <div id="queue-holder"></div>
    </div>
</h:form>  

The f:metadata block which holds my f:viewParam:

<f:metadata>
        <f:viewParam name="callId" value="#{viewInboundCallDetailsMB.callId}" required="true" requiredMessage="Please provide a valid call ID" converter="javax.faces.Long" converterMessage="The call ID is not numeric" />
        <f:viewAction action="#{viewInboundCallDetailsMB.init}"/>
</f:metadata>

Thank you!

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Where did you place the `` tag? The process attribute of `` is set to `@form` by default (and `` to `@all`). Thus, it processes the whole form. You may need to set the process attribute of `` to `@this` instead (in addition to ``). – Tiny Jan 21 '15 at 11:01
  • The ```` tags are used based on a boolean value stored in a ManagedBean which has a session scope. I've already thought about that possibility and tried it before coming up with the ignoreAutoUpdate="true" solution... – Bogdan Cioropină Jan 21 '15 at 11:15

1 Answers1

0

From Primefaces manual about ignoreAutoUpdate: "If true, components which autoUpdate="true" will not be updated for this request. If not specified, or the value is false, no such indication is made."

Which means that it's not going to do update your viewParam component, and other components that have autoUpdate="true".

It's not going to disable the validation on it. (Unless of course, if you are using your poll for validation, which i presume you are not)

Emil Kaminski
  • 1,886
  • 2
  • 16
  • 26