Jump to content

Hostname requirement in order form


Recommended Posts

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

Link to comment
Share on other sites

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">

DNxNun3.png

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! 😀

Link to comment
Share on other sites

  • 1 year later...
  • 11 months later...
  • 6 months later...
  • 1 month later...

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