Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 6th, 2004, 04:08 PM
Authorized User
 
Join Date: Jan 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default Validate chekc

How can I make it so that when a user enters in an id number a routine runs that check if there is already an existing ID here is my stored proc that checks this...

CREATE PROCEDURE IDEXISTCHECK

    @ID varchar(30)

AS

BEGIN

DECLARE @Exist int

                 IF EXISTS (SELECT *
                 FROM MYTABLE
                 WHERE ID = @ID
                 )
                
                
            SELECT @Exist = 1
        ELSE
            
                        SELECT @Exist = 0
PRINT (@Exist)
RETURN (@Exist)

END

In my ASP form is there a way I can call this to run then send some type of alert? If there a a better method of doing this I'll except any suggestions I would like an alert to fire before changes get posted to the stored proc that commits the insert. Please Help. :)
 
Old February 7th, 2004, 09:30 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well using server side code you would create a command object, execute it and check the return value parameter. You should comment out the print statement or set nocount on to avoid generating extra recordsets.
From client side code you would need to use something like msxml2.xmlhttp class to call a web page with the above server code in it. This would return an xml formatted response of true or false.

--

Joe
 
Old February 9th, 2004, 12:25 PM
Authorized User
 
Join Date: Jan 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks do you have by any chance any code examples?

 
Old February 9th, 2004, 12:35 PM
Authorized User
 
Join Date: Jan 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well basically my form allows the user to insert new records, before the values get posted to the next form I want to alert to fire, kinda like when he/she hits the submit button.

 
Old February 9th, 2004, 07:59 PM
Authorized User
 
Join Date: Jan 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is not some way to just call an sp if it returns 1 then fire the error?






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to validate date jijish ASP.NET 2.0 Professional 4 December 20th, 2007 07:17 AM
Validate form dreamdragon Pro JSP 0 December 11th, 2004 08:11 AM
Validate JTextField Cute Designer J2EE 3 November 28th, 2004 03:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.