Solved

Coldfusion Validation

Posted on 2004-09-21
3
243 Views
Last Modified: 2013-12-24
Can someone show me how to do serverside validation for a field that can only have numbers and a field for phone numbers XXX-XXXX.

Do we use regular expressions?
0
Comment
Question by:champ_010
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Author Comment

by:champ_010
ID: 12118050
On second thought I should say that I did not use CFFORM.

My teacher didn't teach us about CFFORM--he just showed us some manual way of doing things like:

<cfparam name="problem" default="no">
<cfif isDefined("form.addBook")>
  <cfif form.bookTitle IS ''>
     <cfset problem='yes'>
     <cfset bookTitle_msg='*'>
</cfif>
 
etc. and in the end if problem="No" then the form validates.

I just realized that there's a whole other thing with cfform and cfinput.  Is this relatively new or why did he not teach us?  I guess I should learn cfform and do away with my manual way?

0
 
LVL 14

Accepted Solution

by:
Renante Entera earned 100 total points
ID: 12118944
Hello champ_010!

I would suggest to do the server-side validation with the involvement of <cfform> tag and <cfinput>.

You can have your code into something like this :

<cfform name="form1" method="post">
Specify no. : <cfinput name="num" type="text" required="yes" validate="integer" message="Invalid number!"><br>
Telephone no . : <cfinput name="telno" type="text" required="yes" validate="telephone" message="Invalid telephone number!">
<input type="submit" value="Submit">
</cfform>

This will validate a field that can only have numbers and a field for phone numbers XXX-XXX-XXXX.

For tutorials, just browse to the following sites :
   <cfform> - http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p38.htm#wp2433198
   <cfinput> - http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p65.htm#wp1100379


Goodluck!
eNTRANCE2002 :-)
0
 
LVL 1

Author Comment

by:champ_010
ID: 12119513
O.k.--I should get around to learning this.  Am glad to see something like this.  I really enjoy the asp.net validation controls--looks like this cfform stuff is just as good.

Thanks
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question