tydoehk
05-26-08, 02:02 AM
So I read through the forums a bit and did not see a way to use check boxes instead of a drop down list when checking for domains from the home page for example (outside of whmcs).
So I put one together, and it seems to work rather well so far. I just gather the values of the checkboxes in javascript and build the bulkdomains field (used in the bulk check option) value adding the new line chars between each. Then send the form off the the domainchecker.php page.
So the onsubmit would return this function call:
If this was already posted somewhere, I apologize for not having found it.
(this code is poc only btw)
function makedq() {
var fdomain = document.getElementById("domain");
var fcom = document.getElementById("com");
var fnet = document.getElementById("net");
var forg = document.getElementById("org");
var fbulk = document.getElementById("bulkdomains");
var dq_arr = new Array();
var dq = "";
var tldcheck = 0;
if(fdomain.value.length > 2) {
// build bulk
if(fcom.checked) {
dq_arr.push(fdomain.value + "." + fcom.value);
++tldcheck;
}
if(fnet.checked) {
dq_arr.push(fdomain.value + "." + fnet.value);
++tldcheck;
}
if(forg.checked) {
dq_arr.push(fdomain.value + "." + forg.value);
++tldcheck;
}
// assemble bulk
for(var r=0; r < dq_arr.length; ++r) {
dq += dq_arr[r];
if(dq_arr[r+1]) {
// add new line
dq += "%0D%0A";
}
}
if(tldcheck > 0) {
fbulk.value = unescape(dq);
/* disable uneeded fields
fdomain.disabled = true;
fcom.disabled = true;
fnet.disabled = true;
forg.disabled = true;*/
return true;
} else {
return false;
}
} else {
return false;
}
}
So I put one together, and it seems to work rather well so far. I just gather the values of the checkboxes in javascript and build the bulkdomains field (used in the bulk check option) value adding the new line chars between each. Then send the form off the the domainchecker.php page.
So the onsubmit would return this function call:
If this was already posted somewhere, I apologize for not having found it.
(this code is poc only btw)
function makedq() {
var fdomain = document.getElementById("domain");
var fcom = document.getElementById("com");
var fnet = document.getElementById("net");
var forg = document.getElementById("org");
var fbulk = document.getElementById("bulkdomains");
var dq_arr = new Array();
var dq = "";
var tldcheck = 0;
if(fdomain.value.length > 2) {
// build bulk
if(fcom.checked) {
dq_arr.push(fdomain.value + "." + fcom.value);
++tldcheck;
}
if(fnet.checked) {
dq_arr.push(fdomain.value + "." + fnet.value);
++tldcheck;
}
if(forg.checked) {
dq_arr.push(fdomain.value + "." + forg.value);
++tldcheck;
}
// assemble bulk
for(var r=0; r < dq_arr.length; ++r) {
dq += dq_arr[r];
if(dq_arr[r+1]) {
// add new line
dq += "%0D%0A";
}
}
if(tldcheck > 0) {
fbulk.value = unescape(dq);
/* disable uneeded fields
fdomain.disabled = true;
fcom.disabled = true;
fnet.disabled = true;
forg.disabled = true;*/
return true;
} else {
return false;
}
} else {
return false;
}
}