Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
validation: Valang global errors Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • validation: Valang global errors

    Hi everybody, I'm trying valang and I really like it. I have one little problem I couldn't figure out how to solve it.
    I have this validator:

    <bean id="pagoValidatorValang" class="org.springmodules.validation.valang.ValangV alidator">
    <property name="valang">
    <value>
    <![CDATA[
    { global : [T<d+12H]>=[T] : 'No se pueden realizar operaciones de pago después del mediodía'}
    { codigoPagoElectronico : ? is not blank : 'El codigoPagoElectronico no puede ser vacío' : 'errores.codigo_pe_vacio' }
    { codigoPagoElectronico : ? is blank or length(?) > 2 : 'El codigoPagoElectronico debe tener mayor longitud'}
    ]]>
    </value>
    </property>
    </bean>

    the 2 last rules are specific for the field 'codigoPagoElectronico' and it works perfect, but I want the first rule to be global, not attached to any field of the command being validated.
    It works at frontend, with the generated javascript, it seems that if valang doesn't find a field that matchs the rule key it assumes it's a global. But if I disable js and the backend validator does the validation, I'm getting this ugly (but expected) error:

    GRAVE: Servlet.service() para servlet spring lanzó excepción
    org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'global' of bean class [net.technisys.defaultapp.beans.Pago]: Bean property 'global' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:540)
    at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:532)
    at org.springframework.validation.AbstractPropertyBin dingResult.getActualFieldValue(AbstractPropertyBin dingResult.java:78)
    .
    .

    Any ideas?

    Thanks in advance

    Alejandro

  • #2
    Same problem. How do I indicate a global error using Valang? Unfortunatelly I didn't find a note in the reference documentation.

    Comment

    Working...
    X