...

View Full Version : jquery help



xiaodao
12-28-2009, 07:32 PM
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&submit=Register+Now"

my 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.

groog
12-28-2009, 07:48 PM
Is boxy a jquery plugin?
Setup alerts throughout your script to check what the variables look like. Also can you post your php side?

xiaodao
12-28-2009, 08:07 PM
yes, it is official plugin

server side


if($_REQUEST['do']=="ajaxRegister"){
echo "haha";
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum