0

I have a simple Meteor app, that lets users fill in a form into a <textarea> which will be displayed on their public profile.

Everything is working, I happen to be using {{#markdown}} to display the text on public profile. Everything works well.

Questions:

  • How would I limit the amount of text the user can submit ?
  • Does Meteor somehow limit this ?
  • Is it a good idea to put a limit on this ?

I assume some code would have to be put in a server js file rather than client js side

No user would need more than a page or two of text.

I know I this will allow only 5K of text in box...

<textarea maxlength="50000">

  • but I think that can be defeated in the browser

~ Thanks

mrmccormack
  • 143
  • 1
  • 10

1 Answers1

0
  1. You are correct in that maxlength will limit browser side. You can also use the .length property of a string server-side to ensure it stays below the character limit you set.
  2. You are only hard-limited by the maximum document size in MongoDB, which is 16MB.
  3. Absolutely. Having a collections of really large strings of text is going to affect performance.
Community
  • 1
  • 1
Stephen Woods
  • 4,049
  • 1
  • 16
  • 27
  • Thanks Stephen, I noticed this on http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_textarea_maxlength (allthe more reason to do server side) **Note:** The maxlength attribute of the textarea tag is not supported in Internet Explorer 9 and earlier versions, or in Opera 12 and earlier versions. – mrmccormack Feb 23 '16 at 16:16