Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 08:11 AM
Marius
Guest
 
Posts: n/a
Default Validate 1st field on form

Hi

I have a form that users fill in, thefirst field is a username, which
must be unique.
Currently only when I attempt the Insert into the DB does the restaint
inform the user that it already exists.
Is there any way i can check , let say onblur, if that username
exists, so that they dont have to complete the whole form before being
informed?

thanks

marius
  #2  
Old July 19th, 2005, 08:11 AM
Bob Barrows
Guest
 
Posts: n/a
Default Re: Validate 1st field on form

a) You could use an XML data island. Here's an example (you will need to
modify it for your purpose - the intent is simply to demonstrate how to pass
the XML to the client):
http://www.davidpenton.com/testsite/...ta.islands.asp

b) You could pass a recordset to the client using XML like this:
http://www.davidpenton.com/testsite/...ver2client.asp,
allowing you to use rs.Find to see if the user has entered a previously-used
name.

c) You could use the XMLHTTPRequest object to pass the user name to another
asp page which determines whether or not it is already used and returns the
result to the calling page.

HTH,
Bob Barrows

Marius wrote:[color=blue]
> Hi
>
> I have a form that users fill in, thefirst field is a username, which
> must be unique.
> Currently only when I attempt the Insert into the DB does the restaint
> inform the user that it already exists.
> Is there any way i can check , let say onblur, if that username
> exists, so that they dont have to complete the whole form before being
> informed?
>
> thanks
>
> marius[/color]


  #3  
Old July 19th, 2005, 08:11 AM
Dan Brussee
Guest
 
Posts: n/a
Default Re: Validate 1st field on form

On 9 Sep 2003 07:22:34 -0700, mariusvdwalt@ananzi.co.za (Marius)
wrote:
[color=blue]
>Hi
>
>I have a form that users fill in, thefirst field is a username, which
>must be unique.
>Currently only when I attempt the Insert into the DB does the restaint
>inform the user that it already exists.
>Is there any way i can check , let say onblur, if that username
>exists, so that they dont have to complete the whole form before being
>informed?[/color]


To do this, you would need one of the following on client side.

A. A list of all current usernames. Probably not practical, plus it
would reveal all usernames to anyone who wanted to look at the source
code :)

B. A way to look up a name quickly on the server. There are a couple
ways of doing this, but the concept of "quick" is relative here. In
all but the best conditions, the turnaround time may be more than what
you want to handle "onblur".

You need to balance the steps you take with the expected value.
Assuming you repopulate the form if a username is not unique, I would
say you are doing fine - especially if you are using a stored
procedure to do the insert. This way, you can check for an existing
username before actually attempting the insert.
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles