Twitter-like Registration with DX Auth |
[eluser]K.Brown[/eluser]
I'm using DX Auth, and I'd like to to behave like twitter's registration--in the sense that it will check the database via ajax to make sure the username/email doesn't conflict... Has anybody done this? If I have to pick a js library, I'd use jQuery!
[eluser]xzela[/eluser]
Actually, I've done something very similar to what you've described. I didn't use the Auth library you supplied but my method should work nearly the same way. I created a Callback using the form validation library. however, i didn't call it via a typical post request. I called it with a jQuery ajax.post request. If the call back found a match for that username, it would respond with a message. See jQuery post documentation here: http://docs.jquery.com/Post Registration controller: Code: $this->load->library('form_validation'); callback function Code: function CB_testUserName($str) { registration model Code: function testUsername($name) { that should do it.
[eluser]K.Brown[/eluser]
Alright. Here's where I’m at: I have the validation working! All I need to do is get it jquery-ed up!
[eluser]juliano.ma[/eluser]
Hello, I am trying to implement this validation in real time on my form, but I must be missing something. I have installed the JSON. You could post an full example in the controller and view, please? Code: <?php Where i use this below, in controller or view?: Code: $json = array(); Look my view: Code: <?=$this->validation->error_string; ?>
[eluser]jcavard[/eluser]
DX Auth already has a built-in function to check username availability. Code: $result = $this->dx_auth->is_username_available($username); // bool
[eluser]juliano.ma[/eluser]
Thanks for the response jcavard, but I would do it in real time, using the onKeyUp javascript event with jquery. Someone have some example?
[eluser]jcavard[/eluser]
I guess you just bind a ajax call to onKeyUp of the username textbox, then you can a script that execute the is_username_available(). |
Welcome Guest, Not a member yet? Register Sign In |