Solved

Coldfusion Validation

Posted on 2004-09-21
3
231 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
  • 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
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…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now