Topic
  • 1 reply
  • Latest Post - ‏2014-01-14T23:21:54Z by DonaldN
JDD23
JDD23
8 Posts

Pinned topic Limit Multi-Line Character Count

‏2014-01-14T16:10:11Z |

Question:  how would I script (BASIC) to limit a multi-line CQ field to a specific character count? 

Specifically, I'd like to limit a text field to 3,000 characters.

Any help would be much appreciated.

Thanks in advance.

JDD

  • DonaldN
    DonaldN
    287 Posts

    Re: Limit Multi-Line Character Count

    ‏2014-01-14T23:21:54Z  

    A multiline_string field essentially contains a string anyway. So I suppose you can just use the "Len" function, or "LenB" if you want bytes, not characters.

    http://msdn.microsoft.com/en-us/library/42byt104%28v=vs.84%29.aspx

    So in the (field/action) validation hook, you retrieve the string length, and throws an exception when it exceeds the given number.