Jump to content

How to prevent clients seeing "WHOIS Opt-Out" unless "Individual" is selected


magga

Recommended Posts

Hi all,

 

This is a simple Javascript addition that hides the "WHOIS Opt-Out" checkbox if the user selects a registrant type other than "Individual" when ordering a .uk domain name.

 

You can see a demo here (you will need to search for a domain and add to cart first)

 

https://www.magdesign.co.uk/clients/cart.php?a=confdomains

 

1. Open up your orderforms > cart > configuredomains.tpl

 

2. Add the following code to the top of the page:

 

{literal}
<script>

function legaltype_onChange(legaltypeDDM) {
var clegaltype = legaltypeDDM.options[legaltypeDDM.selectedIndex].text;
if (clegaltype=="Individual") {
document.getElementById("whois").style.display="table-cell";
document.getElementById("whoischeckbox").style.display="table-cell";
}

else {
document.getElementById("whois").style.display="none";
document.getElementById("whoischeckbox").style.display="none";
}
}
</script>
{/literal}

 

3. Find the following code

 

{foreach key=domainfieldname item=domainfield from=$domain.fields}
{$domainfieldname}: {$domainfield}<br />
{/foreach}

 

and replace this with:

 

<table>
{foreach key=domainfieldname item=domainfield from=$domain.fields}
<tr><td width="130px" {if $domainfieldname eq "WHOIS Opt-out"}id="whois"{elseif $domainfieldname eq "Company ID Number"}id="companyid"{/if}>{$domainfieldname}:</td><td>{$domainfield|regex_replace:"/select name=\"domainfield\[0\]\[0\]\"/":"select name=\"domainfield[0][0]\" id=\"legaltype\" onchange=\"javascript:legaltype_onChange(this)\"/"|regex_replace:"/input type=\"checkbox\"/":"input type=\"checkbox\" id=\"whoischeckbox\"/"|regex_replace:"/name=\"domainfield\[0\]\[2\]\"/":"name=\"domainfield[0][2]\" id=\"companyidtextfield\"/"}</td></tr>
{/foreach}
</table>

 

You may want to change it slightly depending on whether you want to use a table or not but I'm sure you get the idea - it all works quite well!

Link to comment
Share on other sites

Hi all,

 

This is a simple Javascript addition that hides the "WHOIS Opt-Out" checkbox if the user selects a registrant type other than "Individual" when ordering a .uk domain name.

 

Good mod.

 

Can you enhance it further, to force the client to enter a company number if they choose Limited Company? :)

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