Remember I have a content with an Image and a ImageAlt field
The ImageAlt is mandatory (validwhen function) if image is setted.
I've just tested, switching language during the contribution.
For example, I blank the ImageAlt in french, switch to english and valid the form.
The validation don't catch the missing ImageAlt for french.
2005/10/3,
[EMAIL PROTECTED] <[EMAIL PROTECTED]>:
Sébastien Landeau < [EMAIL PROTECTED]> wrote on 03.10.2005 16:27:35:
> Does this mechanism work when in edition, the contributor switch the
> input language by clicking of the language flags in the editing pop-up ?
>
The Jahia Field Input Validation Guide, which is currently linked on the Documentation page is unfortunately an older version. You should read the corrected text in Chapter 17 of the Jahia 4.x Template Developer Guide, which is also linked on the Documentation page.
On page 108 you can read the following:
>> The validator only accesses the getter-methods of those fields, for which you will define validation rules. The field values should be taken from the ContainerFacadeInterface object and for that you should use the inherited methods getJahiaField(String) or getJahiaMultiLanguageField(String). Which method to use depends on the validation rule, which should be applied. Most of the standard validators expect the field value as a String, but there are Jahia specific multilingual validations, which need to get access to all language entries of a field and for those fields you should return a JahiaMltHelper object.
If you want to apply both (standard validators and Jahia multilingual validators) to the same field you should provide two different getter-methods. In this special case, the getter method returning the String must match the field name property, while for the getter method returning the JahiaMltHelper you can choose any property name.<<
So if you use the standard "validwhen" validation rule, your bean method should return a String, even if the field-type is SMALLTEXT and the value is multilingual.
Just use:
public String getImageAlt()
{
return getJahiaField("ImageAlt");
}
This way your "validwhen" rule will check the value of ImageAlt for the current language somebody is working on.
Sébastien Landeau <[EMAIL PROTECTED]> wrote on 03.10.2005 16:27:35:
> Does this mechanism work when in edition, the contributor switch the
> input language by clicking of the language flags in the editing pop-up ?
>
Yes, it should !
Benjamin Papez
Sébastien Landeau < [EMAIL PROTECTED]> wrote on 03.10.2005 16:27:35:
> Does this mechanism work when in edition, the contributor switch the
> input language by clicking of the language flags in the editing pop-up ?
>
The Jahia Field Input Validation Guide, which is currently linked on the Documentation page is unfortunately an older version. You should read the corrected text in Chapter 17 of the Jahia 4.x Template Developer Guide, which is also linked on the Documentation page.
On page 108 you can read the following:
>> The validator only accesses the getter-methods of those fields, for which you will define validation rules. The field values should be taken from the ContainerFacadeInterface object and for that you should use the inherited methods getJahiaField(String) or getJahiaMultiLanguageField(String). Which method to use depends on the validation rule, which should be applied. Most of the standard validators expect the field value as a String, but there are Jahia specific multilingual validations, which need to get access to all language entries of a field and for those fields you should return a JahiaMltHelper object.
If you want to apply both (standard validators and Jahia multilingual validators) to the same field you should provide two different getter-methods. In this special case, the getter method returning the String must match the field name property, while for the getter method returning the JahiaMltHelper you can choose any property name.<<
So if you use the standard "validwhen" validation rule, your bean method should return a String, even if the field-type is SMALLTEXT and the value is multilingual.
Just use:
public String getImageAlt()
{
return getJahiaField("ImageAlt");
}
This way your "validwhen" rule will check the value of ImageAlt for the current language somebody is working on.
