Solved

ColdFusion Validate a Number to Prevent Duplicates

Posted on 2009-04-03
8
212 Views
Last Modified: 2013-12-16
Hello,  I have a ColdFusion form that I need to validate a unique casenumber in an Oracle Database "onBlur" or (somehow prior to the form being submitted to the database).  Can I do this with ColdFusion alone or will I need to incorporate JavaScript?   Is there a best method before I start coding?
0
Comment
Question by:trizzle29
[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
  • 4
  • 4
8 Comments
 

Author Comment

by:trizzle29
ID: 24059396
Here is the textfield
<cfinput type="text"
name="casenumber"
size="30"
required="yes"
onvalidate="???"
message="Please enter your Project Case Number!">
0
 
LVL 52

Expert Comment

by:_agx_
ID: 24060822
Unique in what context?  ie
1. Unique in the Oracle database or ...
2. You have 4 fields and you need to verify they all contain a unique number?

If it is #1, the only bullet proof way to do that is within a database query. If #2, you can use javascript.
0
 

Author Comment

by:trizzle29
ID: 24060861
Thanks for your response.
It is #1
With this method is it possible to verify in Coldfusion through query and have the response received (onBlur) prior to submitting the data to the database?  I am trying to prevent the client from entering a duplicate casenumber and receiving the coldfusion error since the casenumber is the primary key.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 52

Expert Comment

by:_agx_
ID: 24061006
You could use some Ajax to preform a pre-check before submitting the form.  BUT  ... there is no guarantee the case number won't be used in between the time you do the check and do the database insert.  The only bullet proof way is put a cftry/cfcatch around the query to catch the constraint violation. Then display a message if the case number is already in use ie "Please try again"...
0
 

Author Comment

by:trizzle29
ID: 24061025
I will try this and let you know how it turns out.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 24061057
Okay.  I take it the Case Number is not something you can generate automatically. That would avoid the whole issue.
0
 

Author Comment

by:trizzle29
ID: 24061306
Unfortunately the casenumber is assigned in a department that does not want to participate in the automation process.  
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 24061567
Yes, that is what I figured.   Then the try/catch is your best bullet proof option.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Developer 6 75
move expression web site to a new server 13 79
Pivoting oracle table 9 75
What are the limitations of input parameters in oracle ? 5 71
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
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…
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…

697 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