Hello,


We have a container with 2 fields :
  • An Image Field (type FieldTypes.FILE)
  • An ImageAlt Field (type FieldTypes.SMALLTEXT)

We want to check the following validation rule : "The  ImageAlt field is mandatory only if the Image field is not null"

Code of the JavaBean associated to the ImageAlt field :

    public JahiaMltHelper getImageAlt()
    {
        return getJahiaMultiLanguageField("ImageAlt");
    }


Here is an extract of the Jakarta validation Xml file :

< field property = "imageAlt" depends = "validwhen" >
   
< msg name = "validwhen" key = "errors.required" />
   
< arg0 key = "ImageAlt" resource = "false" />
   
< var >
       
< var-name > test </ var-name >   
        < var-value > ((image == null) or (*this* != null)) </ var-value >
   
</ var >
</ field >

This code doesn't work.




If the ImageAlt definition is changed to a FieldTypes.SMALLTEXT_SHARED_LANG type, the rule works fine with the
following modification in the validation JavaBean :
    public String getImageAlt()
    {
        return getJahiaField("ImageAlt");
    }


In this special case all works fine. But we need multi lingual fields !!!


Thank's for your help.


Best regards...

Reply via email to