Limiting the size of a text box - InfoPath Dev
in

InfoPath Dev

Limiting the size of a text box

Last post 02-15-2012 11:15 AM by karson6. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-14-2012 11:22 AM

    Limiting the size of a text box

    I have a comment field where I use a text box contol that I need to limit the size so it doesn't push hard-coded text below it onto a new page.   I know in the text box properties I can limit the number of characters but when I used this, I lose the functionality of letting the users have Paragraph breaks within the text box.

    Is there a way to limit the height of the field, like say to 3 inches and allow both paragraph breaks and wrapping text?  I tried setting the height of the text box under the properties Size tab but this still allows more text (just limits the amount the is viewable without needing a scroll bar.

     My main objective is not allowing the form to bump to another page.

    Thanks!

     

  • 02-14-2012 04:04 PM In reply to

    Re: Limiting the size of a text box

    The functionality you are asking for is not available out of the box.  There might be a custom code solution, but it would likely be difficult to implement since that would require some complex calculation to determine how much text you have + how much width each character is taking up + paragraph/line breaks, etc.

    The best workarounds I can suggest are

    1. Use the scroll bar - this will limit the size of the control but users can type more than the space allows
    2. Use a character limit - this will block users from using paragraph breaks
    3. Use a fixed-width font, set the height of the your text control, and limit the number of characters - probably the closest solution to what you want.  Pick a fixed with font (like courier or consolas) and count the max number of characters that go in a line and multiply by the number of lines your control allows.  Then set the limit to equal that amount.  This will still disallow character breaks, but you can hand modify the xsn to get around this.  However, that might break your max count if you choose to allow paragraph breaks.

    I hope this was informative even though the options aren't exactly what you're looking for.

    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 02-15-2012 11:15 AM In reply to

    Re: Limiting the size of a text box

    Thanks for your post, Anson.   I ended up going with a fixed height on the text box and using a scroll bar when necessary because I need the ability to add paragraph breaks.  The rest is a training issue for users - if they see the scroll bar, then they need to be aware that the form will bump to another page.

     

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.