Hi,
I know this is a dumb question and perhaps a bit OT, most likely, but ... I want to ask anyway.
The goal:
Contain a textarea to a finite limit of number of words or characters?
I've found several ways but nothing seems to be good enough to stop someone that actually wishes to flood a textarea. I wish to limit it to around 20 lines, or about a thousand characters, say.
Note that I am specifically not asking about text boxes et al.
Here's the first question:
1. Is there anyway to use server side code the client cannot negate?
A logical, non-surprise to the visitor so they find out BEFORE trying to submit the form? Preferably in real time.
I've tried a lot of things without success. Js can simply be ignored by the client and on and on ... .
In learning HTML 5 to go with PHP scripts, I've come across the HTML 5 maximum length attribute. Having tested the HTML 5 attribute, it works, assuming a browser supports HTML 5, which I'm sure most miscreants wouldn't use even if they used a "regular" browser.
I only have HTML, PHP and CSS under my belt at this time; so that of course is where my preferences lie, but I'm not adverse to something different as long as it can be called from PHP.
Hopefully I have enough checks in place to know a message might be coming from a miscreant without the textarea limit, but ... there are those who will find it very inviting, I'm sure.
Javascript works great, but ... it's not secure.
So here's question 2:
What do YOU see as the most straightforward way to enforce a length for a textarea?
TIA,
Rivet`