Solved

Coldfusion Validation

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
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 set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

773 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