Hello there!
does anybody know how to limit the size (characters to enter) of a template variable??
plllleeeease help, I can’t find the answer
I believe the TV values for strings are limited to 65,535 characters in PHP5. Less if they contain multibyte characters.
Yeah, I don’t think it’s possible yet
A MODx Fanatic
Hello!
Thanks for your answers, what I am looking for is exactly that, I need to be able to limit the size of a tv, so that I can display it in a string length defined area.
I came up with the solution of having a substring snippet, so I can always cut the output string if needed. I worked for a bit, I have realized that the snippet gets rid of quotation marks. I am using this solution to format the title of various news items, they need quotation marks, so again, I am in the same place... any suggestions guys? please :’(
-
☆ A M B ☆
- 24,524 Posts
You could use a plugin to add some javascript to do this; since it’s from the Manager and with relatively trusted users I don’t imagine the risk of someone hacking the page would be an issue.
I’m presuming you’re using a text input type. If so, the input element for the TV will have an id attribute
like id="tvMyTV". So you could have your javascript add the size and maxlenght attributes to that input element. Something like this:
http://www.brighthub.com/internet/web-development/articles/9231.aspx
-
MODX Staff
- 12,272 Posts
This definitely will require a custom plugin to be written, leveraging Javascript, or manually hacking the associated action page if it applies across the board. (Plugin is the best option)
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me