You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Ing. Thomas Kernstock" <t....@e-technologies.at> on 2010/12/13 16:08:36 UTC

extVal + PrimeFaces 2.2 RC2

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 Primefaces RequestContext API to
determine if validation in the backing bean failed. Normally the
"validationFailed" flag is set automatically on beanvalidation.
Here is part of my backing bean:
 
@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.
 
So my question is if extVal uses a different mechanisms to indicate
validationerrors than the standard valdation ? Do I miss a parameter or
something else to make this work ? 
 
 
best regards
 
Thomas

Re: extVal + PrimeFaces 2.2 RC2

Posted by Gerhard <ge...@gmail.com>.
hi thomas,

please have a look if ViolationExceptionInterceptor gets called after the
violation.

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2010/12/13 Ing. Thomas Kernstock <t....@e-technologies.at>

> 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 Primefaces RequestContext API to
> determine if validation in the backing bean failed. Normally the
> "validationFailed" flag is set automatically on beanvalidation.
> Here is part of my backing bean:
>
> @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.
>
> So my question is if extVal uses a different mechanisms to indicate
> validationerrors than the standard valdation ? Do I miss a parameter or
> something else to make this work ?
>
>
> best regards
>
> Thomas
>