bluerayconcepts Posted March 19, 2016 Share Posted March 19, 2016 (edited) I am wanting to remove the required fields NS1 and NS2 on the dedicated server order form. I have been able to remove the fields but continue to get the must fill out required fields warning. Does anyone know where and how to remove the required field setting for the NS1 and NS2 prefix on the dedicated server order form? Edited March 20, 2016 by bluerayconcepts 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 20, 2016 Share Posted March 20, 2016 I don't think you can remove their requirement - it's hard-coded to check those fields aren't empty... the simplest way around that would be, for dedicated servers, to not show them and pass them as hidden fields - that will allow the information to be passed to the cart, but not show either the fields or an error upon submission. so in standard_cart/configureproduct.tpl, you could replace the nameserver code (which you say you have removed), with... <input type="hidden" name="ns1prefix" class="form-control" id="inputNs1prefix" value=" "> <input type="hidden" name="ns2prefix" class="form-control" id="inputNs2prefix" value=" "> if you only wanted to remove it for some dedicated server products, you could use an {if} statement and specify the ones to ask for nameservers, but the above should remove it for all of your DS products. I haven't testing passing a space as the value thoroughly - so if it causes an issue, just change the values passed to ns1 and ns2. 1 Quote Link to comment Share on other sites More sharing options...
bluerayconcepts Posted March 20, 2016 Author Share Posted March 20, 2016 Thanks Brian that did it. After digging around for a few hours I was starting to figure it was hardcoded someplace 0 Quote Link to comment Share on other sites More sharing options...
hoya8 Posted January 31, 2021 Share Posted January 31, 2021 no joke, it is Brian again! <input type="hidden" name="ns1prefix" class="form-control" id="inputNs1prefix" value="noSN1"> <input type="hidden" name="ns2prefix" class="form-control" id="inputNs2prefix" value="noNS2"> works on WHMCS 8.1 empty space was not working 0 Quote Link to comment Share on other sites More sharing options...
S4hosting Posted May 29, 2021 Share Posted May 29, 2021 Now this method working but have to comment the line locate under standard_cart/configuredomains.tpl Have to comment this line <!-- {foreach from=$domain.fields key=domainfieldname item=domainfield} <div class="form-group row"> <div class="col-sm-4 text-sm-right"">{$domainfieldname}:</div> <div class="col-sm-8">{$domainfield}</div> </div> {/foreach} {/foreach} {if $atleastonenohosting} <div class="sub-heading"> <span class="primary-bg-color">{$LANG.domainnameservers}</span> </div> <p>{$LANG.cartnameserversdesc}</p> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label for="inputNs1">{$LANG.domainnameserver1}</label> <input type="text" class="form-control" id="inputNs1" name="domainns1" value="{$domainns1}" /> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label for="inputNs2">{$LANG.domainnameserver2}</label> <input type="text" class="form-control" id="inputNs2" name="domainns2" value="{$domainns2}" /> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label for="inputNs3">{$LANG.domainnameserver3}</label> <input type="text" class="form-control" id="inputNs3" name="domainns3" value="{$domainns3}" /> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label for="inputNs1">{$LANG.domainnameserver4}</label> <input type="text" class="form-control" id="inputNs4" name="domainns4" value="{$domainns4}" /> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label for="inputNs5">{$LANG.domainnameserver5}</label> <input type="text" class="form-control" id="inputNs5" name="domainns5" value="{$domainns5}" /> </div> </div> </div> --> 0 Quote Link to comment Share on other sites More sharing options...
fary Posted August 2, 2021 Share Posted August 2, 2021 Hello Thanks for your help @brian! I have removed all the fields(Hostname,Root password,ns1,ns2) with your help , but i see their names in whmcs client area whit no fields ! I send you a picture . How can i delete these names here ? 0 Quote Link to comment Share on other sites More sharing options...
fary Posted August 4, 2021 Share Posted August 4, 2021 Hello everyone i fix the problem by delete the line between label tags . I send you a picture of what i did . now i have another problem . when someone ordered a vps , the hostname of the vps is ( nohostname ) and if i dont change it manually the next order receive an error ( The hostname you entered is used before , please try another hostname ) how can i generate random names for every order hostnames ? Thanks 0 Quote Link to comment Share on other sites More sharing options...
string Posted August 4, 2021 Share Posted August 4, 2021 (edited) I don't recommend to do any template changes in the template files, because you need to remember these changes when upgrading WHMCS. Instead use this hook to hide the fields via Javascript + insert a default value. I have attached an example hook (can't post it here, my HTTP requests got blocked from the WHMCS server). You would save this into "includes/hooks/<choosable_filename>.php". Please note that this is not the cleanest hook code-wise. You could remove the "ClientAreaPageCart" hook and just generate the values directly in ClientAreaFooterOutput. Also, the passwords are not generated cryptographically secure. I wrote this hook many years ago. But it should work and give you a good starting point if you want to do better. hook.zip Edited August 4, 2021 by string 2 Quote Link to comment Share on other sites More sharing options...
Web Host Pro Posted August 4, 2021 Share Posted August 4, 2021 13 hours ago, string said: I don't recommend to do any template changes in the template files, because you need to remember these changes when upgrading WHMCS. Instead use this hook to hide the fields via Javascript + insert a default value. I have attached an example hook (can't post it here, my HTTP requests got blocked from the WHMCS server). You would save this into "includes/hooks/<choosable_filename>.php". Please note that this is not the cleanest hook code-wise. You could remove the "ClientAreaPageCart" hook and just generate the values directly in ClientAreaFooterOutput. Also, the passwords are not generated cryptographically secure. I wrote this hook many years ago. But it should work and give you a good starting point if you want to do better. hook.zip 645 B · 2 downloads Wow this is awesome! Can you please help me adjust your hook to remove the root password field but show the hostname field? We only use KVM and you can't choose the root password for it. I think some customers may want to add a custom hostname. Removing those annoying ns1 fields is a godsend. 0 Quote Link to comment Share on other sites More sharing options...
string Posted August 5, 2021 Share Posted August 5, 2021 11 hours ago, Web Host Pro said: Can you please help me adjust your hook to remove the root password field but show the hostname field? This should work: https://pastebin.com/aYQ7cA6d 0 Quote Link to comment Share on other sites More sharing options...
Balram Posted September 6, 2021 Share Posted September 6, 2021 On 8/5/2021 at 3:45 PM, string said: This should work: https://pastebin.com/aYQ7cA6d Hey, i need similar to this please help me with that. i need hook which enter any random hostname and password , I am looking for this from past few months and this is the most relatable thread I have found. Thanks. 0 Quote Link to comment Share on other sites More sharing options...
string Posted September 8, 2021 Share Posted September 8, 2021 On 9/6/2021 at 6:15 PM, Balram said: i need hook which enter any random hostname and password , I am looking for this from past few months and this is the most relatable thread I have found. Please see my previous hook. It does generate a random hostname and a password. 1 Quote Link to comment Share on other sites More sharing options...
afshin-virus Posted September 8, 2021 Share Posted September 8, 2021 On 8/4/2021 at 2:08 PM, string said: I don't recommend to do any template changes in the template files, because you need to remember these changes when upgrading WHMCS. Instead use this hook to hide the fields via Javascript + insert a default value. I have attached an example hook (can't post it here, my HTTP requests got blocked from the WHMCS server). You would save this into "includes/hooks/<choosable_filename>.php". Please note that this is not the cleanest hook code-wise. You could remove the "ClientAreaPageCart" hook and just generate the values directly in ClientAreaFooterOutput. Also, the passwords are not generated cryptographically secure. I wrote this hook many years ago. But it should work and give you a good starting point if you want to do better. hook.zip 645 B · 20 downloads i used this hook but its show this error: Please correct the following errors before continuing: You must enter a hostname for your server You must enter your desired root password my whmcs version is 8.2.1 0 Quote Link to comment Share on other sites More sharing options...
Balram Posted September 8, 2021 Share Posted September 8, 2021 5 hours ago, string said: Please see my previous hook. It does generate a random hostname and a password. Thanks @string, it worked. i am looking for one more hook if possible for you please help. we sell VPS services so hostname or domain most of the time user choose same and if user has many service they get confused which invoice is for which service. Showing Dedicated ip on unpaid invoice or on all invoices whichever possible. screenshot to understand better- https://prnt.sc/1rkz6wm 0 Quote Link to comment Share on other sites More sharing options...
string Posted September 9, 2021 Share Posted September 9, 2021 21 hours ago, afshin-virus said: i used this hook but its show this error: I just tested it with WHMCS v8.2.1 and the hook works fine here. However, I noticed an error when generating the hostname, it did not consist of random characters. I suspect that you did not put the hook into the correct directory. Attached you ind the updated hook including the directory structure, so you can simply upload the extracted content directly to your WHMCS root directory. hook.zip 1 Quote Link to comment Share on other sites More sharing options...
Balram Posted September 11, 2021 Share Posted September 11, 2021 On 9/8/2021 at 2:46 PM, string said: Please see my previous hook. It does generate a random hostname and a password. Thanks @string, it worked. i am looking for one more hook if possible for you please help. we sell VPS services so hostname or domain most of the time user choose same and if user has many service they get confused which invoice is for which service. Showing Dedicated ip on unpaid invoice or on all invoices whichever possible. screenshot to understand better-https://prnt.sc/1rujiy3 0 Quote Link to comment Share on other sites More sharing options...
string Posted September 14, 2021 Share Posted September 14, 2021 The invoice description can be changed via the WHMCS hook InvoiceCreationPreEmail. Unfortunately I don't have a hook for this. I would recommend to have a look in the marketplace if there is a module for it. Alternatively you can look for a developer in the Service Offers & Requests section, if nobody else can provide you a hook. 0 Quote Link to comment Share on other sites More sharing options...
robetus Posted April 12, 2023 Share Posted April 12, 2023 On 9/9/2021 at 2:24 AM, string said: I just tested it with WHMCS v8.2.1 and the hook works fine here. However, I noticed an error when generating the hostname, it did not consist of random characters. I suspect that you did not put the hook into the correct directory. Attached you ind the updated hook including the directory structure, so you can simply upload the extracted content directly to your WHMCS root directory. hook.zip 928 B · 197 downloads Amazing, thanks so much for this. Working great on whmcs 8.7.1 and php 8.1. 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.