Skip to main content
June 19, 2009
Question

maxlength on cftextarea

  • June 19, 2009
  • 2 replies
  • 828 views

I am trying to limit the number of characters input into a cftextarea:

<cfform action="textareaAction.cfm" method="post">

<table>
<tr>
<td width="33">
</td>
<td>

<cftextarea name="NEED_COMMENT" wrap="virtual" rows="5" cols="25"
validate="maxlength" validateAt="onBlur" maxlength="200" onKeyDown="limitText('comments','countdown_comments',200)">
</cftextarea>


<input type="Submit" value="Submit"> <input type="Reset"
value="Clear Form">

</td>
</table>

</cfform>>

It takes more than 200 characters.  If I enter more than 200 characters, upon submit I get an error from the remote DB2 database that the insert did not occur because the string was too long for the column.

Thank you,

Jeanne

This topic has been closed for replies.

2 replies

Known Participant
June 22, 2009

Best method is to validate at server side. So that even if the javascipt is disabled your site will not break.

Inspiring
June 20, 2009

validate at onsubmit instead of onblur.  users can disregard any warnings you throw at them.