How to set limits on line length when formatted text is entered into profile form?

researchcooperative
@researchcooperative
6 years ago
694 posts
When new members paste an existing formatted text from their own computer into a profile field that allows a large amount of formatted text, the text may extend way to the right, making it necessary to scroll from left to right to read a long single line.

Can this only be controlled by disallowing formatted text in the form field set up?

Is there any easy way to set limits on the line length, without preventing users from entering an existing formatted text?


--
PJ Matthews, Kyoto
Migrated from Ning 2.0. Now at Jamroom 6 beta and using Jamroom Hosting for The Research Cooperative (researchcooperative.org)

updated by @researchcooperative: 04/09/18 05:51:16PM
douglas
@douglas
6 years ago
2,790 posts
Are you using the jrCore_format_string:$item.profile_quota_id with the variable for that field?

blog text field example:
{$item.blog_text|jrCore_format_string:$item.profile_quota_id}

Hope this helps!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
researchcooperative
@researchcooperative
6 years ago
694 posts
Thanks.

This happening in the public display of a profile form field, with the field type set as editor.

The validation is set as a "a string", which sounds very open to me.

Could a validation code be designed to set the line (string) length as flexible, but within a fixed limit?

I am not looking at any underlying code, I am just going with what I see as a site administrator.

Thanks


--
PJ Matthews, Kyoto
Migrated from Ning 2.0. Now at Jamroom 6 beta and using Jamroom Hosting for The Research Cooperative (researchcooperative.org)
douglas
@douglas
6 years ago
2,790 posts
The jrCore_format_string is a function that takes text from any form field, editor or textarea type, and formats it according to what you have set in your ACP > Core > System Core > Quota Config > Active Text Formatters.

If you want to limit the number of characters shown from an editor or textarea field, then you may want to use the Smarty truncate variable modifier.

https://www.smarty.net/docs/en/language.modifier.truncate.tpl

Hope this helps!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
SteveX
SteveX
@ultrajam
6 years ago
2,584 posts
researchcooperative:
Could a validation code be designed to set the line (string) length as flexible, but within a fixed limit?
Use minimum and maximum in From designer


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
researchcooperative
@researchcooperative
6 years ago
694 posts
Thanks, I started wondering about this. The help text in Profile form states:

"The Field Minimum Value will validate that any entered value is greater than or equal to the minimum value.......For (string) Fields: This is the minimum character length for the string."

Would this merely set an overall limit for the size of a text, without exerting any control over formatting? Line over-runs might still happen when a strangely pre-formatted text is entered.

Perhaps the simplest thing is to let users make their own beds and lie in them: the text editor is provided so that they can present a biography nicely. If a user is happy to display something messy, that is their responsibility.

My responsibility is to make it more obvious how to use the site functions effectively.

As a test, I went to the user's profile in ACP, selected "View Keys", pressed the "Modify" button, copied the badly formatted text html from the Key file, removed formatting in my email system, pasted this into my own profile page text editor, reformatted, then copied the reformatted text html into the Key file of the member and saved.

This has solved the formatting problem for that particular person, and proves to me that the problem is not inherent in the profile field set up, but in use of the editor by the user.

I will leave this thread open, in case anyone wants to consider fixes that can control or adapt the formatting entered by a site user.

For the present, I consider the matter resolved. Thanks.


--
PJ Matthews, Kyoto
Migrated from Ning 2.0. Now at Jamroom 6 beta and using Jamroom Hosting for The Research Cooperative (researchcooperative.org)
michael
@michael
6 years ago
7,714 posts
You might try the 'paste_as_text' option for TinyMCE.
https://www.tinymce.com/docs/plugins/paste/#paste_as_text

Add:
paste_as_text: true,
into the form_editor.tpl file.

There are 2 one is for TinyMCE in Site Builder the other is in Core.