Categories


How to Limit a Comment Box

In the past, we’ve taken a look at how to set up a basic form that a website visitor might use to

submit information,

request information,

send a comment,

or anything else you might want for that matter.

Having such a form is a good way to communicate with your website’s visitors allowing them a voice or a way to submit information for inclusion on the website if you offer such a service. Might add that using forms allows you, as the website owner, a means to control the information to determine which is acceptable or needs editing if using on the website. And, while forms may be helpful, there are times you may want to limit the visitor’s input. This is especially true for ‘comment’ areas.

Rows and columns typically define a comment box. However, you can add in another variable that will limit the number of characters used there.   To see how this might work – visit this linkNote that we’ve set our box to accept a maximum of 300 characters.  You can set this for any number you like. 

commentbox

We’ve used an online source for the JAVA portion and rather than put parts of the HTML code up piecemeal, we’ve uploaded a page you can view or copy and paste into your HTML editor to use.  It will give you a comment box just  like the sample shown.  There are editorial comments inside the code to show you where you would put the other parts of your form, along with the submit/reset buttons.   These comments are in a light gray color to separate them from the code.   To view the code, visit this link.

Comments are closed.