hi john
In continuation of the above validation code...
I would like to add the another function to the form "onsubmit"
at present this function performs on "onkeyup"
Code:
<input type="text" name="textbox1" onkeyup="toggle_username('textbox1')"/>
i want to perform this function on "onkeyup" and also on "onsubmit"
Code:
function toggle_username(userid) {
if (window.XMLHttpRequest) {
http = new XMLHttpRequest();
} else if (window.ActiveXObject) {
http = new ActiveXObject("Microsoft.XMLHTTP");
}
handle = document.getElementById(userid);
var url = 'check_user.php?';
if(handle.value.length > 0) {
var fullurl = url + 'do=check_username_exists&textbox1=' +
encodeURIComponent(handle.value);
http.open("GET", fullurl, true);
http.send(null);
http.onreadystatechange = statechange_username;
}else{
document.getElementById('user_error').innerHTML = '';
}
}
function statechange_username() {
if (http.readyState == 4) {
var xmlObj = http.responseXML;
var html = xmlObj.getElementsByTagName('result').item(0).firstChild.data;
document.getElementById('user_error').innerHTML = html;
}
}
so that 2 functions perform "onsubmit".
Code:
<form onsubmit="return doValidate();" method="post" name="registerform">
vineet
Bookmarks