mfinsterbusch
New Responder

CMS_INPUT_DOM and its native length (for check LENGTH in rules or check through maxCharacters)

hi out there,

we got to allow editors enter a maximum of char with format tags included.

As i have researched, the formfieldattribute

maxCharacters="4711"

and also the rule-example

   <NOT>
   <GREATER_THAN>
   <PROPERTY source="rules_element" name="LENGTH"/>
   <NUMBER>10</NUMBER>
   </GREATER_THAN>
   </NOT>

consider the plain text only, not the formatted text.

plain text: 1234567890

chars: 10

formatted source-text: <p class="foobar">123<strong>45</strong><i>67</i>890</p>

chars: 56

It is really a difference for us to get the editor leaded to a correct input.

Is it possible to get this check not in an outputchannel- but in a formfield? Did not found any possbilities in the documentation.

thanks a lot,

maik

0 Kudos
3 Replies
MichaelaReydt
Community Manager

Hello Maik,

I am not sure if I understand your question.

You want to check the length of an input, right? But where do you want to check this?

Your first example of the plain text I would expect in an input field like CMS_INPUT_TEXT or CMS_INPUT_NUMBER in the PageStore.

This input is checked by the rules.

Your second example of the source-code i would expect in the HTML output channel.

So I am confused which length you want to check.

Can you give a specific example for your question?

Best regards

Michaela

0 Kudos

Hi Michaela,

i want to check the length in the rules, so that editors can not enter texts wich are greater than x chars.

This problem is for formatted components only (as seen in the headline only, sorry for that), e.g. CMS_INPUT_DOM.

The problem is:

The validation-checks in the rules includes the needed formatted markup, such as "<strong>".

But what we want to check are the characters only, not formatted.

Thanks,

maik

0 Kudos

Hello Maik,

hm... I am confused now.

In the first posting you wrote:

Maik Finsterbusch schrieb:

we got to allow editors enter a maximum of

char with format tags included.

and:

Maik Finsterbusch schrieb:

As i have researched, the formfieldattribute maxCharacters="4711"

and also the rule-example [...] consider the plain text only, not

the formatted text.

plain text: 1234567890

chars: 10

formatted source-text:

<p class="foobar">123<strong>45</strong><i>67</i>890</p>

chars: 56

For me it sounds, as if you wanted to count the text and the format-tags of the source-code, but the attribute maxCharacters and also the rule just counted the plaintext? So - using your examples - your result always was "10" but you wanted "56"?

In the second posting you wrote:

Maik Finsterbusch schrieb:

[...]

The problem is:

The validation-checks in the rules includes the needed formatted markup, such as "<strong>".

But what we want to check are the characters only, not formatted.

This sounds, as if you want to count just the text and not the format-tags, but the rule counts both? So - using your examples of the first posting - you result would be "56" but you need "10" ?

Isn't there a contradiction between your postings?

As you wrote in your first posting the attribute maxCharacters and the shown rule just count the plaintext. You can use them, if you want to count just the plaintext.

If you also want to count the format-tags,too, you need to work with the rendered text in the output-channel. The format-tags are not available before the text is rendered. So you can't check the formatting "on the fly".

In the output-channel you could write the formatted text in a String and check it's length.

Best regards

Michaela

0 Kudos