dizzy1 Posted April 2, 2009 Share Posted April 2, 2009 Alright ive made a register which allows me to check if the username already exists that works fine. BUT i need to get it so if it doesnt exist the form doesnt submit. javascript function checkUsername ( form ) { } html <form action="test.php" method="post" onsubmit="return checkUsername (this);"> <input type="text" name="txtbox1" onblur="checkUser(this.value);" /> <div id='RegisterResult'></div> </form> The RegisterResult brings back if the username is avaliable or unavaliable from another page but how can i bring back a 0 or 1 in javascript so i know if it avaliable or not. Quote Link to comment Share on other sites More sharing options...
corbin Posted April 3, 2009 Share Posted April 3, 2009 How much AJAX experience do you have? Also, it sounds like you might have to use a synchronous request. Quote Link to comment Share on other sites More sharing options...
dizzy1 Posted April 3, 2009 Author Share Posted April 3, 2009 Not a huge ammount, so far what it does is: 1.User Types in Textbox, onblur. 2.Checks Database. 3.Displays If it USERNAME already exists in DB. what i need is: 4.Variable with YES in OR NO. Then when i submit i can call the javascript fuction to check if Username=YESS and if so RETURN TRUE. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.