Jump to content

Uncaught ReferenceError


Recommended Posts

I tested this even on the default six theme but it seems the option that disables the dns inputs when someone selects default DNS on a domain does not work.

I get a JS error:

Uncaught ReferenceError: disableFields is not defined

I think this is happening since as long I can remember using WHMCS. I don't want to believe this is a 3 year old bug so I was wondering if this is something on my installation or someone else also can replicate this.

Just go to a domain and try selecting between the default or customer options in the DNS settings and it should generate the error.

Link to comment
Share on other sites

  • 2 years later...
30 minutes ago, yggdrasil said:

I never reported this to WHMCS and I guess nobody else did. They don't even know it exists.

Yeah it is not hard to fix but annoying when you find it, I actually built something a little more user friendly to replace it, no need to disable the fields but because I use a couple of domain reseller account as well as my own DNS the customer sometime just wants DNS only option and they need to set specific name servers for the DNS only option so I pre-populate them for them. Just add this to the top of the template clientareadomaindetails.tpl

 

<script type="text/javascript">
function disableFields(tclass,value){
	if (value=='usesw'){
		document.getElementsByClassName(tclass)[0].value = 'ns1.servwise.com';
		document.getElementsByClassName(tclass)[1].value = 'ns2.servwise.com';
		document.getElementsByClassName(tclass)[2].value = 'ns3.servwise.com';
		document.getElementsByClassName(tclass)[3].value = 'ns4.servwise.com';
		document.getElementsByClassName(tclass)[4].value = '';
	} else if (value=='enom'){
		document.getElementsByClassName(tclass)[0].value = 'dns1.name-services.com';
		document.getElementsByClassName(tclass)[1].value = 'dns2.name-services.com';
		document.getElementsByClassName(tclass)[2].value = 'dns3.name-services.com';
		document.getElementsByClassName(tclass)[3].value = '';
		document.getElementsByClassName(tclass)[4].value = '';
	} else if (value=='opensrs'){
		document.getElementsByClassName(tclass)[0].value = 'ns1.systemdns.com';
		document.getElementsByClassName(tclass)[1].value = 'ns2.systemdns.com';
		document.getElementsByClassName(tclass)[2].value = 'ns3.systemdns.com';
		document.getElementsByClassName(tclass)[3].value = '';
		document.getElementsByClassName(tclass)[4].value = '';
	} else {
		document.getElementsByClassName(tclass)[0].value = '';
		document.getElementsByClassName(tclass)[1].value = '';
		document.getElementsByClassName(tclass)[2].value = '';
		document.getElementsByClassName(tclass)[3].value = '';
		document.getElementsByClassName(tclass)[4].value = '';
	}
}
</script>

Then i have this code so the user can choose between using it with our hosting, DNS only via our website or their own name servers.

<div class="radio">
                <label>
                    <input type="radio" name="nschoice" value="default" onclick="disableFields('domnsinputs','usesw')"{if $defaultns} checked{/if} /> {$LANG.sw_dns_servwise}
                </label>
            </div>
             <div class="radio">
                <label>
                    <input type="radio" name="nschoice" value="custom" onclick="disableFields('domnsinputs','{$registrar}')"{if !$defaultns && $nameservers[1].value eq "dns1.name-services.com" || $nameservers[1].value eq "ns1.systemdns.com"} checked{/if} /> {$LANG.sw_dns_DNSmanagement}
                </label>
            </div>
            <div class="radio">
                <label>
                    <input type="radio" name="nschoice" value="custom" onclick="disableFields('domnsinputs','')"{if !$defaultns && $nameservers[1].value neq "dns1.name-services.com" && $nameservers[1].value neq "ns1.systemdns.com"} checked{/if} /> {$LANG.nschoicecustom}
                </label>
            </div>

 

Edited by ServWise.com
Link to comment
Share on other sites

15 hours ago, ServWise.com said:

Yeah it is not hard to fix but annoying when you find it, I actually built something a little more user friendly to replace it, no need to disable the fields but because I use a couple of domain reseller account as well as my own DNS the customer sometime just wants DNS only option and they need to set specific name servers for the DNS only option so I pre-populate them for them. Just add this to the top of the template clientareadomaindetails.tpl

 


<script type="text/javascript">
function disableFields(tclass,value){
	if (value=='usesw'){
		document.getElementsByClassName(tclass)[0].value = 'ns1.servwise.com';
		document.getElementsByClassName(tclass)[1].value = 'ns2.servwise.com';
		document.getElementsByClassName(tclass)[2].value = 'ns3.servwise.com';
		document.getElementsByClassName(tclass)[3].value = 'ns4.servwise.com';
		document.getElementsByClassName(tclass)[4].value = '';
	} else if (value=='enom'){
		document.getElementsByClassName(tclass)[0].value = 'dns1.name-services.com';
		document.getElementsByClassName(tclass)[1].value = 'dns2.name-services.com';
		document.getElementsByClassName(tclass)[2].value = 'dns3.name-services.com';
		document.getElementsByClassName(tclass)[3].value = '';
		document.getElementsByClassName(tclass)[4].value = '';
	} else if (value=='opensrs'){
		document.getElementsByClassName(tclass)[0].value = 'ns1.systemdns.com';
		document.getElementsByClassName(tclass)[1].value = 'ns2.systemdns.com';
		document.getElementsByClassName(tclass)[2].value = 'ns3.systemdns.com';
		document.getElementsByClassName(tclass)[3].value = '';
		document.getElementsByClassName(tclass)[4].value = '';
	} else {
		document.getElementsByClassName(tclass)[0].value = '';
		document.getElementsByClassName(tclass)[1].value = '';
		document.getElementsByClassName(tclass)[2].value = '';
		document.getElementsByClassName(tclass)[3].value = '';
		document.getElementsByClassName(tclass)[4].value = '';
	}
}
</script>

Then i have this code so the user can choose between using it with our hosting, DNS only via our website or their own name servers.


<div class="radio">
                <label>
                    <input type="radio" name="nschoice" value="default" onclick="disableFields('domnsinputs','usesw')"{if $defaultns} checked{/if} /> {$LANG.sw_dns_servwise}
                </label>
            </div>
             <div class="radio">
                <label>
                    <input type="radio" name="nschoice" value="custom" onclick="disableFields('domnsinputs','{$registrar}')"{if !$defaultns && $nameservers[1].value eq "dns1.name-services.com" || $nameservers[1].value eq "ns1.systemdns.com"} checked{/if} /> {$LANG.sw_dns_DNSmanagement}
                </label>
            </div>
            <div class="radio">
                <label>
                    <input type="radio" name="nschoice" value="custom" onclick="disableFields('domnsinputs','')"{if !$defaultns && $nameservers[1].value neq "dns1.name-services.com" && $nameservers[1].value neq "ns1.systemdns.com"} checked{/if} /> {$LANG.nschoicecustom}
                </label>
            </div>

 

Thanks, I guess populating the fields with the nameservers is one way to fix it. I was surprised that such a small bug in the user interface caused so many troubles with people. Because they automatically start to complete the custom fields when they should not. It's very confusing to have the custom fields enabled and fillable when someone clicks on default DNS servers instead of just marking them as read only.

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