Solved

ColdFusion Validate a Number to Prevent Duplicates

Posted on 2009-04-03
8
208 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
  • 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
 
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

896 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

17 Experts available now in Live!

Get 1:1 Help Now