0

I have a form:

<form action="" method="post" id="form"  name="form">
<p><label for="name">Name</label><input type="text" id="name" value="" name="name" /></p>

<p><label for="uname">Username<input type="text" id="username" name="username" value=""/></p>
 </form>

Jquery with jqueryvalidationform:

var validator = $("#form").validate({  
    ignore: ':hidden',          

    rules: {
                name:{
                        required:true,
                        remote: {
                                type: "post",
                                url: "remote-file.php",
                                data: {
                                        username: function() {
                                            return $("#username").val();

                                        }
                                }
                        },


                },
                username: "required", 
..........  

I would like the name: sent to the remote file where it is converted to a username (lower case remove spaces etc.), checked with other usernames (sql), returned as call back and then placed in a readonly username input field. The above shows the callback as required but doesn't input in the form and on submit calls an error to both name and username.

What jquery can I use to fill the username input field with the callback on changing the name?

3
  • What is the question here? The above shows the callback as required but doesn't input in the form and on submit calls an error to both name and username.
    – Anshu
    Sep 24, 2012 at 11:16
  • Sorry the form code didn't show and I have added the question.
    – martyn
    Sep 24, 2012 at 11:28
  • no sure why I lost points on this. It is a perfectly legitimate question.
    – martyn
    Sep 24, 2012 at 18:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.