PeterMu
I'm new here

Rules concerning validation of empty form elements in non released sections

Jump to solution

Hi,

I'm trying to create rules to validate that certain form elements are not empty when saving.

Our site is in French and English and some sections exist in only one language or the other: all content is not necessarily present in both languages.

I'm running into a problem, because I don't know how to take into account the translated state of sections. A simple example

On a page I can have 3 sections :

Section 1 (EN | FR)

Section 2 (EN | FR)

Section 3 (EN | FR)

In the forms I have a "text" element which should not be empty.

The rule I am using (and which is incorrect) is:

<RULES>

          <ON_SAVE>

                    <WITH>

                              <NOT>

                                        <AND>

                                                  <PROPERTY name="EMPTY" source="text"/>

                                                  <PROPERTY name="TRANSLATED" source="#global"/>

                                        </AND>

                              </NOT>

                    </WITH>

                    <DO>

                              <VALIDATION>

                                        <PROPERTY name="VALID" source="text"/>

                                        <MESSAGE lang="*" text="The annex text must not be empty if you wish to publish in a specific language!"/>

                                        <MESSAGE lang="FR" text="Le texte d'une section annexe ne peut pas être vide si vous souhaitez publier dans une mangue spécifique!"/>

                              </VALIDATION>

                    </DO>

          </ON_SAVE>

</RULES>

The property name=TRANSLATED" is at the page level and I would need to be able to force validation only if a particular section has been marked as translated not the page, as a page can exist in a specific language without all sections being generated for the output in that specific language.

section_validation_rule.png

0 Kudos
1 Solution

Accepted Solutions
mbergmann
Crownpeak employee

Hi Peter,

the property to access the sections' setting is named INCLUDED instead of TRANSLATED. The reason is that he checkmark on sections does not mean "translated" but is only a language specific ON/OFF switch for sections.

The difference here is for example that there is no fallback to the content in the master language like it can be configured for pages.

Michael

View solution in original post

0 Kudos
1 Reply
mbergmann
Crownpeak employee

Hi Peter,

the property to access the sections' setting is named INCLUDED instead of TRANSLATED. The reason is that he checkmark on sections does not mean "translated" but is only a language specific ON/OFF switch for sections.

The difference here is for example that there is no fallback to the content in the master language like it can be configured for pages.

Michael

0 Kudos