![]() |
Home Community Mys-Script Creative Off-Topic |
|
![]() |
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
![]()
Thank you! When you get to it it will be lovely if you can share the results ^^ I will share mine if I can put it to work and fix these annoyances. Or maybe I can post what I already have and maybe we can fix it somehow when you have time?
I tried the onblur() thing, but it didn't seem to do anything xD I will investigate on how to use it. Makes sense to only avaliate the full word after clicking away or tabbing (and thank you, I agree on that xD I will keep echo'ing then, I don't know how much javascript I will need - I will probably only have that stuff in the register page plus in another page, so there's really no need to include it everywhere I guess) --------------------------------------------------------- So with tabbing, it seems to work perfectly. With anything else like clicking outside it keeps spazzing out: Without me doing anything it will keep reading the full word, then half the word, then just one letter lol xD The current code is like this: PHP Code:
__________________
![]() ![]() ![]() asp.net stole my soul. Last edited by IntoRain; 02-04-2014 at 01:32 PM. |
#2
|
||||
|
||||
![]()
Ok, well, on my test (unrelated to Mysidia):
Code:
<script> window.initQueue.push(function(){ $("#regusername").focus(function() { $("label[for=regusername]").addClass('error').removeClass('success').removeClass('valid').text(''); }); $("#regusername").focusout(function() { $("label[for=regusername]").addClass('error').removeClass('success').removeClass('valid').text(''); }); $("#regusername").focusin(function() { $("#message").text("").css({'display' : 'none'}); }); $("#regusername").change(function(){ $("#message").html("Checking..."); var username=$("#regusername").val(); $.ajax({ type:"post", url:"./assets/php/check.php", data:"username="+username, success:function(data){ if(data==0){ $("#message").text("Username available!").css({'display' : 'none', 'color' : 'green', 'font-size' : '.8em', 'padding' : '2px 8px', 'margin-top' : '2px'}); } else{ $("#message").text("Username already taken!").css({'display' : 'inline-block', 'color' : 'red', 'font-size' : '.8em', 'padding' : '2px 8px', 'margin-top' : '2px'}); $("label[for=regusername]").addClass('error').removeClass('success').removeClass('valid').text('');} } }); }); }); </script> Code:
<? mysql_connect("127.0.0.1","root",""); mysql_select_db("test"); $username=$_POST["username"]; $query=mysql_query("SELECT * from users where Username='$username' "); $find=mysql_num_rows($query); echo $find; ?> You can safely ignore all the adding and removing of success/valid/error classes I did (because I was combining it with another system that also checked for minimum/maximum length requirements... and that passwords had a number, matched, and emails had an @). I was using the same span for both types of confirmation of success and if one was true but not the other, the whole span needed to be red. (ie: Yeah, it fits the minimum requirements for length, but it's taken so it needs to be red and throw and error, not have the green success check.) Last edited by Kyttias; 02-04-2014 at 04:36 PM. |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
jQuery - Spiffing up your page where you can't edit the HTML! | Kyttias | Tutorials and Tips | 3 | 01-29-2014 06:09 PM |
Jquery one weekend? | Tony | Other Chat | 0 | 07-30-2011 06:34 PM |
Javascript/Jquery not being run. [Answered] | exactly33 | Questions and Supports | 5 | 12-23-2009 11:39 AM |
What's New? |
What's Hot? |
What's Popular? |