Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: jquery help

  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts

    jquery help

    I am using boxy for this pop up register form, however the ajax no working, it does not post to "user.php" nothing happens except an long array append to my index.php like "index.php?username=&userpass=&cpass=&useremail=&name=&phone=&address=&postal=&do=ajaxRegister&submi t=Register+Now"

    my code
    Code:
    	$('#register').click(function(){
    		var boxy_content;
    		boxy_content += "<form id=\"registerform\" class=\"formular\"><fieldset>";
    		boxy_content += "<label><span>Username: </span><input id=\"name\" name=\"username\" type=\"text\" class=\"validate[required,custom[noSpecialCaracters],length[0,20],ajax[ajaxUser]]\" size=\"20\" /></label>";
    		boxy_content += "<label><span>Password: </span>	<input id=\"pass\" name=\"userpass\" type=\"password\"  class=\"validate[required,length[6,11]] text-input\" size=\"20\" /></label>";
    		boxy_content += "<label><span>Confirm Password: </span><input id=\"cpass\" name=\"cpass\" type=\"password\"  class=\"validate[required,confirm[password]] text-input\" size=\"20\" /></label>";
    		boxy_content += "<label><span>Email:</span><input id=\"email\" name=\"useremail\" type=\"text\" class=\"validate[required,custom[email]] text-input\" size=\"20\" /></label>";
    		boxy_content += "<label><span>Name: </span><input id=\"name\" name=\"name\" type=\"text\" size=\"20\"  class=\"validate[optional,custom[onlyLetter],length[0,100]] text-input\"/></label>";
    		boxy_content += "<label><span>Phone: </span><input id=\"phone\" name=\"phone\" type=\"text\" size=\"20\"  class=\"validate[required,custom[telephone]] text-input\" /></label>";
    		boxy_content += "<label><span>Address : </span><input id=\"subject\" name=\"address\" type=\"text\" class=\"validate[required]] text-input\" size=\"20\" /></label>";
    		boxy_content += "<label><span>Postal Code : </span><input id=\"subject\" name=\"postal\" type=\"text\" class=\"validate[required]] text-input\" size=\"20\" /></label>";
    		boxy_content += "<input type=\"hidden\" name=\"do\" value=\"ajaxRegister\" /><input type=\"submit\" name=\"submit\" class=\"buttonSubmit\" value=\"Register Now\" /></fieldset>";
    		boxy_content += "</form>";
    		registerBoxy = new Boxy(boxy_content, {
    		    title: "Register As A Member",
    		    draggable: false,
    		    modal: true,
    		    behaviours: function(c) {
    				c.find('#registerform').submit(function() {
    					Boxy.get(this).setContent("<div style=\"width: 300px; height: 300px\">Sending...</div>");
    					// submit form by ajax using post and send 3 values: subject, your_email, comment
    					$.post("user.php", $('#registerform').serialize(),
                        function(data){
                            /*set boxy content to data from ajax call back*/
                            registerBoxy.setContent("<div style=\"width: 300px; height: 300px\">"+data+"</div>");
                        });
    
    					return false;
    				});
    		    } 
    		});
    		return false;
    	});
    another problem i want to ask is how to validate the form browser side under this circumference, i implemented one validation plugin but no working in boxy.
    flying dagger

  • #2
    New Coder
    Join Date
    Jun 2007
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is boxy a jquery plugin?
    Setup alerts throughout your script to check what the variables look like. Also can you post your php side?

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts
    yes, it is official plugin

    server side
    Code:
    if($_REQUEST['do']=="ajaxRegister"){
    	echo "haha";
    }
    flying dagger


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •