Hi, Please give me suggestion. My form has two fields (User Id and Password). UserId should be unique. I should allow users to complete the form only if they enter a unique UserID, if not as he enters userid and tabs to Password field, I should check for the exsistance of USerId in the database and alert him to enter a different ID. Thanks, Deepa
Bear Bibeault
Author and opinionated walrus
Marshal
Well if you have to check the database, you can't do it completely on the client side. You either need to wait until the user submits the form to check the database as part of the post handling, or (and I DO NOT recommend this) post the form, or a subset of it, every time the user tabs out of the field to check if its value is unique. Another apporach (which I'd also argue against) is to create a JavaScript array as the page is being constructed (perhaps via JSP) populated with all the existing usernames. A few seconds of thought will reveal why this is not a recommended approach. The conventional appraoch is to simply perform server-side checks upon form submission. hth, bear