Solved

Coldfusion Validation

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

Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…

840 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