Limit the amount of lines in a multi-line text box
This InfoPath demo is the completed solution for a bonus recipe in InfoPath 2013 Cookbook in which rules are used to restrict the amount of lines to a maximum in a multi-line text box on an InfoPath 2013 form.
In this bonus recipe you will learn how to use rules to restrict the amount of lines to a maximum in a multi-line text box on an InfoPath 2013 form.
InfoPath demo video transcript:
Here I'm in SharePoint 2013 where I've already published an InfoPath form template to this SharePoint form library. So if I click new document to add a new form, you'll see that as soon as the InfoPath form opens, it will display this multi-line text box control on it.
If I enter a line here and then click away, you'll see that a 1 should appear here as the number of lines. I can then enter a second line and click away, and then you'll see a 2 appear. I can also enter an empty line and then when I click away you'll see a 4 appear as the number of lines.
I've added data validation to this multi-line text box to only allow a maximum of 4 lines to be added to the multi-line text box. So if I add a fifth line here and then click away, you'll see that this data validation error will appear on the multi-line text box. And when I remove lines and make the amount 4 or less, in this case 3, you'll see that the validation error will disappear.
I can also save this form back to the form library, close it, and then when I reopen it, we should still see those 3 lines appear in the multi-line text box and the amount of lines being 3. So now I can add lines again and then when I click away we should see a 4 appear.
Related InfoPath Demo Videos:
- Populate a drop-down list box with dates excluding weekends
- Shrinking drop-down list in a repeating table
- Limit a multi-select list box to a maximum of 3 selected items
- Auto-populate a drop-down list box with past and future dates
Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.