• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to use TRIM DATA in CFFORM?

New Here ,
Jun 25, 2006 Jun 25, 2006

Copy link to clipboard

Copied

How to use TRIM DATA in CFFORM? when data is retrieving from DATABASE. Wanna rtrim and ltrim while spaces.
TOPICS
Advanced techniques

Views

354

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

What do you mean? Please give example.

do you want to do this?

<cfform name="myForm" method="post" action="abc.cfm">
<cfinput type="text" name="myField" value="<cfoutput>#TRIM(sql.data)#</cfoutput>">
</cfform>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

Check out the SQL functions LTrim/RTrim for MSSQL. Not sure about MySQL but I think there is a Trim function.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

LATEST
Better to trim those values after the form submission.
Once you put them into form,
user may also makes mistake by hitting space, right?

Also, by trimming all form fields after submission, you will be sure that your DB is clean... no whitespaces on it.
Well unless someone insert data directly onto it :)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation