I have a requirement to limit the number of characters entered into a WYSIWYG field. I set up a validation rule to check if the asLength property of the field is > the number of characters, but it fires when far fewer characters than specified is entered.
If I change the field type from WYSIWYG to plain text, the validation rule works as expected, firing when the specified number of characters is exceeded.
I suspect it's because extra "stuff" is added to the WYSIWYG data, such as bold or italic or whatever, so asLength is counting all that as well.
Am I doing something wrong? Is there a way to get this working? Is there something besides the asLength property that can be used?
I put together a quick test form that does not behave as expected, shown here:
<ac:structured-macro ac:macro-id="1cffb15f-6562-4909-bb37-c1d5f2dbaedf" ac:name="confiform-card" ac:schema-version="1">
<ac:parameter ac:name="formName">TestForm</ac:parameter>
<ac:parameter ac:name="enableInlineAdd">true</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="cc81ed3e-5bf3-44ed-ac87-61d1635f9907" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">Description</ac:parameter>
<ac:parameter ac:name="withLabel">true</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="81b2a2ce-821a-4bc5-8917-168d7b31c842" ac:name="confiform-entry-edit" ac:schema-version="1">
<ac:parameter ac:name="inline">true</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="029b473b-4ea3-4558-b796-3123caef6b80" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="printEnabled">true</ac:parameter>
<ac:parameter ac:name="formName">TestForm</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="098774fd-0593-4620-a892-4205e2fc2846" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">Description</ac:parameter>
<ac:parameter ac:name="fieldLabel">Description (max 10):</ac:parameter>
<ac:parameter ac:name="type">wysiwyg</ac:parameter>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="b54e4456-4727-44fc-961d-b8141e1c7949" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">Description.asLength:>10</ac:parameter>
<ac:parameter ac:name="fieldName">Maximum of 10 characters</ac:parameter>
<ac:parameter ac:name="action">Validation rule</ac:parameter>
<ac:parameter ac:name="actionFieldName">Description</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
Entering 1234567890 into that form fails, and even entering 1234 fails. Entering 123 works.
Thank you.
That would be through the extractText function the easiest...
Description.extractText.asLength
https://wiki.vertuna.com/spaces/CONFIFORMS/pages/2359385/Virtual+functions
Hi @alfiej ,
There are some related questions to the WYSIWYG field, such as this one Confiforms: How to do export WYSIWYG Field Content Without HTML Tags, but I'm guessing we're not talking about that here.
Alex is usually the one from their support team browsing this forum, but if you don't get help, you can always reach out to the vendor directly (probably the preferred way of communication) via one of their support channels.
I haven't played much with those, so I probably can't give any decent insights on the topic :/
Cheers,
Tobi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.