• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Detecting form error in Coldfusion

Hey All,

        I want to detect a coldfusion form error and handle it gracefully.  Basically a text area field in a form has its input capped via javascript at 7000 characters and the associated database field has a 7000 character limit.  The problem is that some users have javascript disabled on their browser and thus may go over the character limit; resulting in an error page being displayed (Error Executing Database Query.  [Macromedia][SQLServer JDBC Driver][SQLServer]String or binary data would be truncated. )  
      Rather than having this occur, is there a away to detect the error and gravefully handle it; as in displaying a page that says something to the effect of "this field has too many characters, the limit is 7000 and you have input 7210; please press back and reduce the fields content"  etc.   Thank you very much.

1 Solution
in the server side

<cfif len(form.textField) gt 7000>
    <!--- display error message here and re-display input form --->
andrewaielloAuthor Commented:
Yes; that will work.  Thanks.

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now