I've got an enter/edit screen created for people to enter new systems. Before the new system gets submitted I have the submit page query the database to make sure that a record doesn't already exist with that name. If it does, I set the url back to the enter/edit screen. Is there a way I can have the coldfusion popup a message stating that the user entered an entry that already exists?
Here is a snipped from the submit page: -
<cfif isDefined("Form.Add")>
-
<cfquery name="validateName" datasource="Security_Access" dbtype="ODBC">
-
select sysID from tblSystem
-
where name='#Form.name#'
-
</cfquery>
-
<cfif "validateName.RecordCount" eq 1>
-
<cflocation URL="system.cfm">
-
<cfelse>
-
.................
-
5 3229
You can popup a message using JavaScript. You could pass a variable in the url to show that validation failed and check that to show the popup in the original page.
Alternatively, just show an error message on screen.
Excellent thanks!!
Will CF create the javascript for me? I don't really know javascript all that well, so I've been relying on the javascript that CF creates.
Excellent thanks!!
Will CF create the javascript for me? I don't really know javascript all that well, so I've been relying on the javascript that CF creates.
If you just want a simple alert, the Javascript is very easy, e.g. - alert("You entered an entry that already exists!");
Of course, you would use Coldfusion to check first and then put the Javascript within <script> tags, e.g. - <cfif isDefined("url.error")>
-
<script>...</script>
-
</cfif>
One other alternative is to post to the same page, i.e. your form and action pages are the same. In this way, if there is an error, you can display the alert and then display the form again, instead of using cflocation.
One other alternative is to post to the same page, i.e. your form and action pages are the same. In this way, if there is an error, you can display the alert and then display the form again, instead of using cflocation.
That's a good idea, I should look into implementing that.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: David Gray |
last post by:
Greetings all,
Quick newbie type question:
I would like to be able to trap non-numerical data entered into a
textbox via CTRL+C and/or Shift+Insert.
I realise that this data can be...
|
by: Morné |
last post by:
Hi
how do I validate a text value in a datagrid e.g. the user is only
allowed to type in a Y or a N. I specifically have a problem with
using the PropertyDescriptorCollection. I get the...
|
by: Shapper |
last post by:
Hello,
I have created 3 functions to insert, update and delete an Access
database record. The Insert and the Delete code are working fine.
The update is not. I checked and my database has all...
|
by: Geoffrey KRETZ |
last post by:
Hello,
I'm wondering if the following behaviour is the correct one for
PostGreSQL (7.4 on UNIX).
I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching
the following request :...
|
by: David Bear |
last post by:
I have a dictionary that contains a row of data intended for a data base.
The dictionary keys are the field names. The values are the values to be
inserted.
I am looking for a good pythonic...
|
by: ameen.abdullah |
last post by:
Hi Guys,
I have a textbox in windows form that should only accept alphabets,
numbers, spaces and underscore. If the textbox contains anyother
character it should display a msg at the time of...
|
by: rn5a |
last post by:
During registration, users are supposed to enter the following
details: First Name, Last Name, EMail, UserName, Password, Confirm
Password, Address, City, State, Country, Zip & Phone Number. I am...
|
by: anuradha135 |
last post by:
I have a textarea in my jsp, where in the user will enter a sql query of select or insert or update or delete.I have to validate that entered data and say whether the query is syntatically correct...
|
by: satyabhaskar |
last post by:
hi all,
In my web page i have created radio buttons dynamically on to the page .....following is my code
string Course, Semester, Section;
int rowsCount;
string con =...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |