Ristrict richtextbox content with some character limit. - InfoPath Dev
in

InfoPath Dev

Ristrict richtextbox content with some character limit.

Last post 09-14-2011 06:44 AM by maheshmrk22. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-14-2011 02:32 AM

    Ristrict richtextbox content with some character limit.

    I am developing an Infopath which contains richtextbox. I have set some data validations rules on that. I want the user to be restricted to put the text beyond perticular character limit. I have tried to do it through conditional formatting but could not achieve. I even tried to achieve it through _OnAfterChange event of the richtextbox.   

           public void test_richtextabstract_OnAfterChange()

             {     

                string nodeText = e.newValue;
                if (!string.IsNullOrEmpty(nodeText) && nodeText.Length > 1000)
                {
                     string truncatedText = nodeText.Substring(0, 1000);
                     e.newValue =truncatedText ;
                }

    }

  • 09-14-2011 04:29 AM In reply to

    Re: Ristrict richtextbox content with some character limit.

    Have you tried putting a validation rule on the field?  That seems to work.  Trying to truncate it is a bad idea because richtext is XHTML, which cannot be arbitrarily truncated.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-14-2011 06:44 AM In reply to

    Re: Ristrict richtextbox content with some character limit.

    I tried it but it does not restrict user to type the content beyond limit. BTW I think I am very near to the resolution.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.