tydoehk Posted May 26, 2008 Share Posted May 26, 2008 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; } } 0 Quote Link to comment Share on other sites More sharing options...
chickendippers Posted May 26, 2008 Share Posted May 26, 2008 The code is in Utilities > Integration Code. 0 Quote Link to comment Share on other sites More sharing options...
tydoehk Posted May 26, 2008 Author Share Posted May 26, 2008 Actually no, the code in "integration code" is for a select field NOT a group of checkboxes. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS CEO Matt Posted May 26, 2008 WHMCS CEO Share Posted May 26, 2008 Why don't you just use a simple form with regular checkboxes for the TLD selections? Matt 0 Quote Link to comment Share on other sites More sharing options...
chickendippers Posted May 26, 2008 Share Posted May 26, 2008 My apologies tydoehk, I misread your post. 0 Quote Link to comment Share on other sites More sharing options...
tydoehk Posted May 26, 2008 Author Share Posted May 26, 2008 Why don't you just use a simple form with regular checkboxes for the TLD selections? Matt Thats what I did, but in order to pass in a check for something like: mydomain .com, .net and .org you have to send to the bulk check form. Otherwise you can only check one tld per query. 0 Quote Link to comment Share on other sites More sharing options...
juiced Posted July 7, 2008 Share Posted July 7, 2008 Could you post your form code here aswell? (whole page would be awesome) Cheers 0 Quote Link to comment Share on other sites More sharing options...
tydoehk Posted July 7, 2008 Author Share Posted July 7, 2008 I just collect the checked values and pass them to the bulk checker. The form calls some JS that takes care of that. Nothing spectacular, and Im sure theres a cleaner way to do it, but: 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; } } and the form is something like: <form method="post" action="/clients/domainchecker.php" name="dnsform" id="dnsform" onsubmit="return makedq();"> <input name="domain" id="domain" value="" size="40" type="text" class="tldtext"> <div class="tldgrp"><input name="com" id="com" value="com" type="checkbox" class="tldcb" /><span class="tld">COM</span></div> <div class="tldgrp"><input name="net" id="net" value="net" type="checkbox" class="tldcb" /><span class="tld">NET</span></div> <div class="tldgrp"><input name="org" id="org" value="org" type="checkbox" class="tldcb" /><span class="tld">ORG</span></div> <input type="hidden" name="bulkdomains" id="bulkdomains" value="" /> <input type="hidden" name="search" value="bulk"> </form> I hope that helps you out or gets you headed in the direction you need. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.