Jump to content
magga

How to add check/uncheck all TLD's on the simple domain checker

Recommended Posts

I have put some code together to allow checking and unchecking all TLD's within the simple domain availability checker.

 

You can see a demo here: http://www.magdesign.co.uk/clients/domainchecker.php

 

To add this, follow the instructions below:

 

First, open your domainchecker.tpl file

 

Add the following code to the top of the page:

 

{literal}
<script LANGUAGE="JavaScript">
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
if(!document.forms[FormName])
	return;
var objCheckBoxes = document.forms[FormName].elements[FieldName];
if(!objCheckBoxes)
	return;
var countCheckBoxes = objCheckBoxes.length;
if(!countCheckBoxes)
	objCheckBoxes.checked = CheckValue;
else
	// set the check value for all check boxes
	for(var i = 0; i < countCheckBoxes; i++)
		objCheckBoxes[i].checked = CheckValue;
}
</script>
{/literal}

 

Find the code:

 

<form method="post" action="domainchecker.php" >

 

And change it to:

 

<form method="post" action="domainchecker.php" name="domainchecker">

 

Now you just need to add the below code wherever you want the "Check all | Uncheck all" links to appear:

 

<a href="javascript:SetAllCheckBoxes('domainchecker', 'tlds[]', true);">Check all</a> | <a href="javascript:SetAllCheckBoxes('domainchecker', 'tlds[]', false);">Uncheck all</a>

 

Hopefully some of you may find this useful!

Share this post


Link to post
Share on other sites
I have put some code together to allow checking and unchecking all TLD's within the simple domain availability checker.

 

You can see a demo here: http://www.magdesign.co.uk/clients/domainchecker.php

 

To add this, follow the instructions below:

 

First, open your domainchecker.tpl file

 

Add the following code to the top of the page:

 

{literal}
<script LANGUAGE="JavaScript">
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
if(!document.forms[FormName])
	return;
var objCheckBoxes = document.forms[FormName].elements[FieldName];
if(!objCheckBoxes)
	return;
var countCheckBoxes = objCheckBoxes.length;
if(!countCheckBoxes)
	objCheckBoxes.checked = CheckValue;
else
	// set the check value for all check boxes
	for(var i = 0; i < countCheckBoxes; i++)
		objCheckBoxes[i].checked = CheckValue;
}
</script>
{/literal}

 

Find the code:

 

<form method="post" action="domainchecker.php" >

 

And change it to:

 

<form method="post" action="domainchecker.php" name="domainchecker">

 

Now you just need to add the below code wherever you want the "Check all | Uncheck all" links to appear:

 

<a href="javascript:SetAllCheckBoxes('domainchecker', 'tlds[]', true);">Check all</a> | <a href="javascript:SetAllCheckBoxes('domainchecker', 'tlds[]', false);">Uncheck all</a>

 

Hopefully some of you may find this useful!

 

Where can i add this Code? :

<a href="javascript:SetAllCheckBoxes('domainchecker', 'tlds[]', true);">Check all</a> | <a href="javascript:SetAllCheckBoxes('domainchecker', 'tlds[]', false);">Uncheck all</a>

 

The file domainchecker.php is encoded and i when i add this doce it indicates that the file is corrupted.

 

Please help

Share this post


Link to post
Share on other sites

You could do this with jquery as well:

 

<script language="javascript">
$('#checkAll').click(
  function()
  {
     $("INPUT[type='checkbox']").attr('checked', $('#checkAll').is(':checked'));   
  }
)

</script>

 

Then in the body, Add a checkbox to do the checking for you:

<input type="checkbox" name="checkAll" id="checkAll"/> Check All

Share this post


Link to post
Share on other sites
You could do this with jquery as well:

 

<script language="javascript">
$('#checkAll').click(
  function()
  {
     $("INPUT[type='checkbox']").attr('checked', $('#checkAll').is(':checked'));   
  }
)

</script>

 

Then in the body, Add a checkbox to do the checking for you:

<input type="checkbox" name="checkAll" id="checkAll"/> Check All

 

Which files do i require to edit (to add these code)?

Share this post


Link to post
Share on other sites

The jquery code should work fine as long as jquery.js is included on the page. The <script> code can really go anywhere, but if its in a template you'll need to wrap it in {literal} tags. The additional checkbox should go somewhere near the existing checkboxes you want to "checkall" on.

Share this post


Link to post
Share on other sites
Does this work in 4.3.1? I can't seem to get it working.

 

This code appears in two places in domainchecker.tpl

<form method="post" action="domainchecker.php">

 

Make sure to change both of them to

<form method="post" action="domainchecker.php" name="domainchecker">

Share this post


Link to post
Share on other sites
Where can i add this Code? :

<a href="javascript:SetAllCheckBoxes('domainchecker', 'tlds[]', true);">Check all</a> | <a href="javascript:SetAllCheckBoxes('domainchecker', 'tlds[]', false);">Uncheck all</a>

 

The file domainchecker.php is encoded and i when i add this doce it indicates that the file is corrupted.

 

Please help

 

I change the code a Little bit... I but red color and I put bold...

 

<a style="color: rgb(229, 91, 0); font-weight: bold;"

href="javascript:SetAllCheckBoxes('domainchecker', 'tlds[]', true);">Check All</a><span style="font-weight: bold;"> | </span><a style="color: rgb(229, 91, 0); font-weight: bold;" href="javascript:SetAllCheckBoxes('domainchecker', 'tlds[]', false);">Uncheck All</a>

 

See Example at : https://www.arealhosting.com/domainchecker.php

Edited by Sylvie

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines