[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

ColdFusion Validate a Number to Prevent Duplicates

Posted on 2009-04-03
8
Medium Priority
?
220 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
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 2000 total points
ID: 24061567
Yes, that is what I figured.   Then the try/catch is your best bullet proof option.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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 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…
The purpose of this video is to demonstrate how to Import and export files in WordPress. 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 : Click on Too…

656 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