Skip to main content
June 19, 2009
Question

maxlength on cftextarea

  • June 19, 2009
  • 1 reply
  • 2306 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.

    1 reply

    Dileep_NR
    Inspiring
    June 22, 2009

    Hi,

    Please try the following ,

    1) <cfset strValue = left(NEED_COMMENT,200)>

    2) Use "strValue " for inserting data into database

    June 22, 2009

    Hi,

    Please try the following ,

    1) <cfset strValue = left(NEED_COMMENT,200)>

    2) Use "strValue " for inserting data into database

    Is "strValue" a variable?  I need to have five text areas in the form, all with a max of 200 characters.

    Thank you,

    Jeanne

    Dileep_NR
    Inspiring
    June 23, 2009

    try this

    insert into.....

    values(

    <cfqueryparam cfsqltype="cf_sql_varchar"  value="# left(NEED_COMMENT,200)#">,

    <cfqueryparam cfsqltype="cf_sql_varchar"  value="# left(NEED_COMMENT1,200)#">,

    <cfqueryparam cfsqltype="cf_sql_varchar"  value="# left(NEED_COMMENT2,200)#">,

    <cfqueryparam cfsqltype="cf_sql_varchar"  value="# left(NEED_COMMENT3,200)#">,

    <cfqueryparam cfsqltype="cf_sql_varchar"  value="# left(NEED_COMMENT4,200)#">)