dickm Posted May 13, 2011 Share Posted May 13, 2011 I am having trouble trying to control the amount of data that a user can enter in a textarea on a form. The code (just a small segment of the full page form that I have is as follows: <hr /> <p><b>Special Notes Regarding this form information: </b></p> <p><textarea cols="45" rows="5" name="comments" wrap="hard"> </textarea></p> <br /> <hr /> I have the limit set at 5 rows, but when typing in the area, the user can continue on and on and this will be unacceptable. I have thought of a message to say only type on the first 5 lines, but that doesn't seem to be very professional. Any help would be appreciated Mahalo, Link to comment Share on other sites More sharing options...
Antonio Conte Posted May 13, 2011 Share Posted May 13, 2011 Thought I posted here earlier? Maybe I forgot to push the Add Reply-button... You can't check number of rows. What you can do is check for a certain LENGTH of the comment (and this should be about 5 rows) Lets say that 255 characters. §comment = §_POST['comment']; if (strlen(§comment) < 255) { echo "You can only type 255 characters, Twitr style!"; } // some other checks aswell 1 Link to comment Share on other sites More sharing options...
Larry Posted May 13, 2011 Share Posted May 13, 2011 Antonio is correct, although you could use JavaScript to provide feedback and limitations as the user types. Link to comment Share on other sites More sharing options...
Recommended Posts