[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ColdFusion Validate a Number to Prevent Duplicates

Posted on 2009-04-03
8
Medium Priority
?
225 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

872 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