myFaces extVal + RequestContext validationFailed

UI Components for JSF
Post Reply
tkernstock
Posts: 65
Joined: 29 Jun 2010, 14:39
Location: Vienna, Austria

13 Dec 2010, 17:15

Hi all,

I'm using Glassfish 3.0.1, CoDI 0.9.1, extVal 2.0.4 and PrimeFaces 2.2RC2. I'm using the Callbackparameters of the RequestContext API to determine if validation in the backing bean failed. Normally, what I've seen in the showCase, the "validationFailed" flag is set automatically on beanvalidation.
Here is part of my backing bean, the @Equals anntoation is from myFaces extVal:

Code: Select all

@Named
@RequestScoped
public class KontoeinstellungenBean extends AbstractProfilBean {
private static final long serialVersionUID = 4849123094557530545L;

@Size(min = 8, max = 20)
@Equals(value = "kennwort2", parameters = ViolationSeverity.Error.class)
private String kennwort;

@Size(min = 8, max = 20)
private String kennwort2;
The view is a simple dialog with 2 password fields ->

Code: Select all

<p:dialog header="#{msgs.kennwort_titel}" widgetVar="dlgChangepassword" modal="true" >
      <h:form id="changePasswordForm">
          <h:panelGrid id="changePassword" columns="2" style="border:2px" rowClasses="row-0, row-1">
           <h:outputLabel for="kennwort"  value="#{msgs.kennwort_neuesKennwort}" />
     <h:inputSecret id="kennwort" value="#{kontoeinstellungenBean.kennwort}" />
     <h:outputLabel for="kennwort2"  value="#{msgs.kennwort_neuesKennwort2}" />
     <h:inputSecret id="kennwort2" value="#{kontoeinstellungenBean.kennwort2}" />
              <f:facet name="footer">
               <p:commandButton value="#{msgs.portal_button_change}" update="growl @form" actionListener="#{kontoeinstellungenBean.changePassword}" oncomplete="handleComplete(xhr, status, args)"/>
           </f:facet>
          </h:panelGrid>
          <p:messages showDetail="true" showSummary="false" />
         </h:form>
  </p:dialog>
  
   <script type="text/javascript">
   function handleComplete(xhr, status, args) {
    if(!args.validationFailed) {
     dlgChangepassword.hide();
    }
   }
  </script>
-> when I type in a password that is smaller than 8 digits plus the two passwords are different, the "valdationFailed" flag is set and as a result I don't close the dialog -> both errormessages are displayed in the <h:messages > field.
When I type different passwords longer than 8 digits the "valdationFailed" flag isn't set and as a result I close the dialog.

Did I miss soemthing here or Is this a problem in the RequestContext API or does extVal simply not set the right field, flag .....?
Using: Eclipse 2020-06, Java 8, Primefaces 8, Omnifaces 3.6.1, Payara Server 5.201, Deltaspike 1.8.2

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 25 guests