How do I restrict an user from exceeding data of a particular length in a TEXTAREA like we do with a text box using the maxlength attribute?

Alessandro A. Garbagnati

The text area doesn't have an attribute like maxlength, so there are two ways to check this: a client side and a server side.

The first one (client side check) has to be written with a language like JavaScript. It's a simple check that doesn't allow to submit the form if the size of the field is greater than your max.

The second solution (server side) is written in the language you're using (probably java) and it does the same thing, but after the form has been submitted.

Good programming practice should suggest you to do both. This will avoid an invalid submission (save time and resources) and because if the client doesn't have JavaScript (rare situation) or has Javascript disabled (it happens often), it will work anyway.