Frozen233 Posted August 8, 2018 Share Posted August 8, 2018 Hello, Apparently something changed in this new 7.6 Update as for why hostnames are a 'must' now. With this I mean: In my order form, for Dedicated/VPS servers, I had the fields 'hostname, ns1, ns2' hidden because many customers were confused by it. Instead, I had that part 'hidden' and a fixed value 'N/A' filled automatically. This 'trick' still works, except for the 'hostname' value. As it now reports that the value 'NA' is already in use. Therefore, I cannot autofill the value N/A there. Is there any way to always fill a random value as hostname? Or to remove that 'check if hostname exsits' step? Code shown below: {if $productinfo.type eq "server"} <div class="sub-heading"> <span>{$LANG.cartconfigserver}</span> </div> <div class="field-container"> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label for="inputHostname">{$LANG.serverhostname}</label> <input type="text" name="hostname" class="form-control" id="inputHostname" value="{$server.hostname}" placeholder="Fill a server name in ex: myserver01"> </div> </div> <div hidden> <div class="col-sm-6"> <div class="form-group"> <label for="inputRootpw">{$LANG.serverrootpw}</label> <input type="password" name="rootpw" class="form-control" id="inputRootpw" value="NA"> </div> </div> </div> </div> <div hidden> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label for="inputNs1prefix">{$LANG.serverns1prefix}</label> <input type="text" name="ns1prefix" class="form-control" id="inputNs1prefix" value="NA" placeholder="ns1"> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="inputNs2prefix">{$LANG.serverns2prefix}</label> <input type="text" name="ns2prefix" class="form-control" id="inputNs2prefix" value="NA" placeholder="ns2"> </div> </div> </div> </div> </div> {/if} If you look at the first part, you'll see the value= field. If i put NA there just like I did in the rest, it does report that value is already being used. Thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 8, 2018 Share Posted August 8, 2018 1 hour ago, Frozen233 said: Apparently something changed in this new 7.6 Update as for why hostnames are a 'must' now. https://docs.whmcs.com/Changelog:WHMCS_V7.6 Quote CORE-12138 - Improve validation of server hostname and nameserver in cart 1 hour ago, Frozen233 said: This 'trick' still works, except for the 'hostname' value. As it now reports that the value 'NA' is already in use. Therefore, I cannot autofill the value N/A there. Is there any way to always fill a random value as hostname? Or to remove that 'check if hostname exists' step? if you want to edit the template, you could always use {$smarty.now} to add a timestamp as the hostname... not random, but unless you get 2 users ordering at exactly the same time, it should work... 1 hour ago, Frozen233 said: <input type="text" name="hostname" class="form-control" id="inputHostname" value="host{$smarty.now}" placeholder="Fill a server name in ex: myserver01"> alternatively, you could use a ClientAreaPageCart hook, generate a random string, optionally check that it hasn't been previously used in the db, and then pass it back to the template as $server.hostname - but if you've already edited the template to add the other NA values, then you might as well just edit the template one more time! 😀 6 Quote Link to comment Share on other sites More sharing options...
Frozen233 Posted August 8, 2018 Author Share Posted August 8, 2018 Thanks a lot Brian. That worked perfectly :) 0 Quote Link to comment Share on other sites More sharing options...
serveria Posted June 4, 2020 Share Posted June 4, 2020 Sorry for necroposting just wanted to say thanks. Very easy yet elegant fix. Works like a charm. 0 Quote Link to comment Share on other sites More sharing options...
hmaddy Posted May 15, 2021 Share Posted May 15, 2021 In which file we need to enter this code.??? 0 Quote Link to comment Share on other sites More sharing options...
flixhost Posted November 26, 2021 Share Posted November 26, 2021 Does this still work? 0 Quote Link to comment Share on other sites More sharing options...
BITW Posted January 25, 2022 Share Posted January 25, 2022 On 11/27/2021 at 2:46 AM, flixhost said: Does this still work? This has worked, i checked this today. Cheers :) 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.