validate length on multi-line text box with paragraph breaks - InfoPath Dev
in

InfoPath Dev

validate length on multi-line text box with paragraph breaks

Last post 03-21-2011 12:11 PM by tafavorite. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 04-02-2008 01:11 AM

    validate length on multi-line text box with paragraph breaks

    Hi,

    I need to have a multi-line text box that validates for length and allows paragraph breaks.  I have seen a solution on here to use a pattern match against, e.g., ".{101,}" for a 100-character limit, however, I am finding that this technique only works if the user does not enter any paragraph breaks!

    Does anyone have a solution for this that actually works?  It needs to work as a single xsn for both InfoPath 2003 and 2007.

    Is the general accepted approach just to make all multi-line textbox fields match against ntext in the SQL database and not enforce any length validation?

     Thanks,

     Craig

  • 04-02-2008 07:23 AM In reply to

    Re: validate length on multi-line text box with paragraph breaks

    Hi Craig Welcome to the forum.

    If you need to be able to send large data types, rich text, more than the 256 character limit to SQL, I could show you how to do this. it sounds like that would solve a lot of headaches for you. Email me and I could show you.

  • 04-02-2008 09:00 AM In reply to

    Re: validate length on multi-line text box with paragraph breaks

    Hi Clay,

    Thanks.  I really need to go the other way though.  My form has many textboxes and I am sending it to a webservice then on to SQL. 

    I want the users to be able to enter paragraph breaks but still restrict the amount of data that they can enter, instead of letting them enter tons of data and having to use ntext columns in SQL.

    Can it be done?

    Thanks,

    Craig

  • 04-02-2008 12:01 PM In reply to

    Re: validate length on multi-line text box with paragraph breaks

    You can put character limits on fields in properties.

    I was thinking you were breaking it up to get around the default limits with basic SQL connectivity.  With web services you do not have that limit.

    You can take a lot of data with an Nvarchar(Max) vs an Ntext.

    If you need help or want to see an example of how I do it just let me know.

  • 04-03-2008 03:11 AM In reply to

    Re: validate length on multi-line text box with paragraph breaks

    Hi Clay,

    No, my problem is just the opposite.  I want to set a character limit on a multi-line text box but still allow paragraph breaks.  InfoPath seems to have no way to do this.

    Craig

  • 04-03-2008 07:40 AM In reply to

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

    Re: validate length on multi-line text box with paragraph breaks

    Hi,

    Add the following validation expression on textfield: string-length(.) > 100

    A newline is counted as 1 char.

     

    Regards,

    Albert

  • 03-21-2011 12:11 PM In reply to

    Re: validate length on multi-line text box with paragraph breaks

    I just tried this, wish someone would have commented if it had worked and it does. Hoepfully if someone comes across this they can take it that it works. I have tested it. Just set the 100 to whatever character limit you want though. But this works. thank you.

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