Form Validation with multi-lingual fields ?

Sébastien Landeau <[email protected]>
Newsgroups gmane.comp.cms.jahia.template,gmane.comp.cms.jahia.devel
Message-ID <[email protected]>
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_LANGtype, 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...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.