Issue with JQuery remote validation or Codigniter syntax? |
[eluser]Dandy_andy[/eluser]
I have an issue with a JQuery remote validation in my Codeigniter project. I'm not sure if this is a problem with the JQuery side or Codeigniter. I have two remote requests from a form, one calling to search for usernames that already exist and the other to call for emails that already exist. The username remote request works fine but for some reason the email one doesn't work at all (it did work up until a week ago and I can't remember what, if anything, I changed to stop it from working). Bearing in mind the username request is working fine, am I missing something obvious for the email remote request??? The relevant part of my view is:- Code: <form method="post" action="<?php echo base_url('register/verify'); ?>" class="form-horizontal" id="registerform" name="registerform"> My Controller has the following functions:- Code: public function check_username() { And my model uses:- Code: //check username address doesn't already exist during registration Any ideas why the username remote query works but my email one doesn't? They essentially have the same functions so I am very confused... Thanks
[eluser]Dandy_andy[/eluser]
Have just done an error analysis and it appears the username is being posted but the email isn't. Any ideas why?
[eluser]Aken[/eluser]
According to your jQuery, the selectors for your two fields have no distinguishing class or ID punctuation on them, just the names. How the username one matches, I don't know. But "em" is a valid HTML element, so it's looking for that rather than your field. You need to have the ID hash in there. Code: data: $("#usernamenew").val()
[eluser]Dandy_andy[/eluser]
Strangely, I tried the code with the hash and changed the 'em' field to 'mailadd' to avoid any HTML element issues and neither username or mailadd work. When I remove the hash from the username field (usernamenew), that one works fine but the email one still isn't working. I'm really baffled now...
[eluser]Dandy_andy[/eluser]
Thank goodness for the Mozilla web developer error console. I've spotted whats wrong. It's actually an issue with the Model. One of the DB fields is incorrect and problem now all sorted. Regarding the #hash before the fields, if I use a hash, the code doesn't work. But without a hash, it all works fine.
[eluser]Aken[/eluser]
That's because it looks like you're setting the data parameter wrong. At least according to the documentation: http://docs.jquery.com/Plugins/Validatio...ods/remote |
Welcome Guest, Not a member yet? Register Sign In |