Board index JavaServer Faces General myFaces extVal + RequestContext validationFailed

myFaces extVal + RequestContext validationFailed

Components, Ajax Framework, Utilities and More.


Posts: 44
Location: Vienna, Austria
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:

@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 ->

<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 Helios, Glassfish v3.1, Primefaces 2.2.1, MyFaces CODI 1.0.0

Return to General

cron