Limit Size of Input in Rich Text Box - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Limit Size of Input in Rich Text Box

Last post 09-05-2012 07:48 AM by cheraideva2. 30 replies.
Page 1 of 3 (31 items) 1 2 3 Next >
Sort Posts: Previous Next
  • 07-05-2005 08:52 AM

    • Rip
    • Not Ranked
    • Joined on 02-04-2005
    • USA
    • Posts 20

    Limit Size of Input in Rich Text Box

    Is there any way that you can limit the amount of characters entered in a Rich Text Box? I am loading this data into a SQL Server database and am having field overflow problems.

    Richard T. Henry
    Lewisberry, PA, USA
    riphenry@gmail.com
  • 07-05-2005 09:17 AM In reply to

    Re: Limit Size of Input in Rich Text Box

    This is not really possible because rich text boxes do not store just characters. They store HTML, which includes both tags and text and inline images.

    Say your limit was 500 characters. If someone typed just text, they would never be able to type a full 500 characters because the text would be surrounded by a tag with a namespace. Add in a table and you get even less actual typing. Add an image and your sure to overshoot your limit immediately. Any text formatting will reduce the amount of actual text.

    There's not good answer for you here, other than to not use a rich text field at all or to update the data type used in SQL.

    Greg Collins [InfoPath MVP]
    InfoPath Dev
  • 07-22-2005 09:02 AM In reply to

    • tgo
    • Not Ranked
    • Joined on 06-30-2005
    • Posts 16

    Re: Limit Size of Input in Rich Text Box

    I used mysql extensively before having to use infopath and mssql, and in mysql if you use varchar and lets say you have varchar (30) , any strings that are larger than that are truncated to 30 characters so if mssql is the same you can do that.

    Also if you have any custom code already you can add a check in for the length of that certain field and if it is too large then make an alert and do not update the database.

  • 07-22-2005 06:39 PM In reply to

    Re: Limit Size of Input in Rich Text Box

    I like the OnBeforeChange custom code solution that TGO is referring to, but Greg is correct because the XHTML will contain formatting characters etc, so the OnBeforeChange code that validates length will have to parse the XHTML and correctly count the real characters (and not things like BASE64 encoded images!). Lots of work.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 08-09-2005 06:52 AM In reply to

    • Rip
    • Not Ranked
    • Joined on 02-04-2005
    • USA
    • Posts 20

    Re: Limit Size of Input in Rich Text Box

    My final solution for this issue was to turn off all the available formatting for the rich text box. I then put in data validation using the regular expression .{251,} (limit field to 250 characters). I know this defeats most of the power of a rich text box but at least the field can still expand as needed.

    Richard T. Henry
    Lewisberry, PA, USA
    riphenry@gmail.com
  • 08-09-2005 10:28 AM In reply to

    Re: Limit Size of Input in Rich Text Box

    Hi Richard,
    Thanks for posting the final solution!

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 10-26-2006 01:37 PM In reply to

    Re: Limit Size of Input in Rich Text Box

    Hi--

    I am trying to do the same thing--limit characters in a regular text box that has paragraph breaks.I don't understand the solution posted here. If I go into the options for my text box and open the validation window and select "The expression" from the first drop down and type in .{251,} I get an error. What expression will create a character limit?

    Thanks!
    Hilary
  • 10-26-2006 11:51 PM In reply to

    Re: Limit Size of Input in Rich Text Box

    Hi Hilary,
    Good question. What you want to do is to use a pattern. In the designer, double click on the text field. Click Data Validation. Select field1 and for "matches pattern" in the middle dropdown. For the third dropdown in the Data Validation dialog, choose "Select A Pattern". The Data Entry Pattern dialog appears. Select "custom pattern" and type ".{251,}" (without double quotes) into the Custom Pattern field. Click OK 4 times and preview - don't forget to add screen tip, etc. if you haven't done this.
    Patrick Halstead
    Project Manager at Qdabra
  • 10-27-2006 08:17 AM In reply to

    Re: Limit Size of Input in Rich Text Box

    Thanks so much...that does what I want. I appreciate your quick help!
  • 04-07-2008 10:34 PM In reply to

    Re: Limit Size of Input in Rich Text Box

    Hi friends,

    i want to give a custom pattern to Textbox.

    when i am entering numbers into textbox(for example : if iam entering numbers like 3332224444) ,

    then  the numbers should automatically fell in the textbox like 333-222-4444

    i think everyone understood this...

    please help me to do this..

    Thank you

    Sreasty

  • 04-08-2008 04:34 AM In reply to

    • Albert
    • Top 500 Contributor
    • Joined on 04-03-2008
    • The Netherlands
    • Posts 32

    Re: Limit Size of Input in Rich Text Box

    Hi, create a rule on the textfield, though it will actually change the data.
     
    Set the value of the field to: concat(substring(., 1, 3), "-", substring(., 4, 3), "-", substring(., 7, 4))
    Its also possible (and better imho) to apply the rule when it matches the following pattern: \d{10}
     
    Regards,
     
    Albert
  • 04-08-2008 11:12 AM In reply to

    Re: Limit Size of Input in Rich Text Box

    Yes, having the condition on there prevents other issues. Then you can also add custom validation to check whether the value is in the right format.

  • 04-09-2008 10:21 PM In reply to

    Re: Limit Size of Input in Rich Text Box

    Thank you albert,

    its working perfectly and we got same thing using custom pattern also  (\d\d-\d\d\d\-\d\d\d\d)*

    Thank you for ur immediate response

    Sreasty

  • 04-11-2008 10:41 AM In reply to

    Re: Limit Size of Input in Rich Text Box

    Sreasty -- I'm glad you got it working!

    Albert -- Thanks for your responses!

  • 04-21-2008 09:04 PM In reply to

    Re: Limit Size of Input in Rich Text Box

    Hi Friends , 

    thank you very much for all your support,

    now i got another issue which is related to custom pattern of a textbox.

    Problem Description:

    i had one text box in my form,  the textbox should not allow any other language characters like japanese, chinese etc

    (indirectly the textbox should allow  english alphabets , numbers and all special characters only).

    can u please help me out in this..

    thank you so much in advance.

    regards

    sreasty

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