Ajax: strange behaviour while checking a textfield

Posted by ilnur777 on Stack Overflow See other posts from Stack Overflow or by ilnur777
Published on 2010-05-23T10:07:17Z Indexed on 2010/05/23 10:10 UTC
Read the original article Hit count: 228

Filed under:
|
|
|

I have a registration form with checking the available name for username field through ajax. Inputing a username into username field and pushing the "Check!" button, the script sends value to php script. Then php script replaces the username field with the username field + style like this:

<input type="text" name="login" value="'.$_GET["user"].'" style="width:205; height:22; border-width:1; border-color:red; border-style:solid; background-color:rgb(255,232,230);">

So when replacing the username field in the form with its equivalent from php script and then submitting a form, it is then get to script on the page that checks whether the username field is empty or not. And it returns an error that it is empty, though after checking through ajax the username field it has value.

I don't understand why it gets to empty field checking script, having the same field name and having value?

© Stack Overflow or respective owner

Related posts about php

Related posts about AJAX