Jump to content

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


magga

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!

Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...
  • 2 weeks later...
  • 3 weeks later...
  • 3 weeks later...
  • 1 year later...
  • 2 months later...
  • 3 weeks later...
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

Link to comment
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

Link to comment
Share on other sites

  • 2 weeks later...
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)?

Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated