Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. Limit the characters in RichtextBox

Limit the characters in RichtextBox

Scheduled Pinned Locked Moved SharePoint
javascripttutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    navkrishkannan
    wrote on last edited by
    #1

    Hello all, how can we limit the no of characters in to richtextbox. please check the below code how to fire an javascript code in this? InputFormTextBox txtAction = new InputFormTextBox(); txtAction.TextMode = TextBoxMode.MultiLine; txtAction.Rows = 6; txtAction.AllowHyperlink = true; txtAction.RichText = true; txtAction.RichTextMode=SPRichTextMode.FullHtml; txtAction.ID = "txtBox"; thanks

    M 1 Reply Last reply
    0
    • N navkrishkannan

      Hello all, how can we limit the no of characters in to richtextbox. please check the below code how to fire an javascript code in this? InputFormTextBox txtAction = new InputFormTextBox(); txtAction.TextMode = TextBoxMode.MultiLine; txtAction.Rows = 6; txtAction.AllowHyperlink = true; txtAction.RichText = true; txtAction.RichTextMode=SPRichTextMode.FullHtml; txtAction.ID = "txtBox"; thanks

      M Offline
      M Offline
      Michael J Eber
      wrote on last edited by
      #2

      Around the time I wrote a language compiler using a richtext box, I do seem to recall that the amount of text was basically unlimited. Anyway what you could do is hook into the KeyDown method and implement a character counting routine. It gets tricky because you have to track when the back arrow is used to insert a character, when the delete key is hit, when the backspace key is hit, etc. But for testing purposes (and other usability reasons) you could include a small text box that displays the character count on the side. Also add a tooltip that states the max character limit. Put everything in place and then start to pound the daylights out of it and ensure the character count comes out right. You should, however, be very aware of the fact that the character count will not define the length of text in the result. The reason is because everything is wrapped in Rich Text format characters which will add extra length to everything no matter what you do.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups