PDA

View Full Version : Limit string length of rich text content control



g8r777
07-26-2011, 04:56 PM
I'm not sure if anyone here can help. I am trying to limit the amount of characters a user can type into a rich text content control. I know you can do this with legacy controls but I am trying not to use them.

I am also trying not to use macros if I can help it. It seems there may be a way to do this using XML. I know that is not technically within the scope of this forum but I figured it is worth a shot. If anyone can point me in the right direction I would appreciate it.

Thank you,

Brian

gmaxey
07-26-2011, 09:59 PM
Brian, This is a swag because it is late and I don't have time to fully test but I am pretty sure the answer is no. You probably could using a plain text control mapped to a customXMLPart node and a schema restriction but rich text controls can't be mapped.

Using a macro the "Document_ContentControlOnExit" event you alert users after the fact that the text length exceeds a limit and cancel the event but still this doesn't stop a user from entering text.

DanielHowden
07-27-2011, 12:23 AM
Here you go this will limit the input to 5 characters.

TextBox1.MaxLength = 5

Cheers Daniel.