Jump to content

Domain form validating


erwin123

Recommended Posts

We just had a customer trying to register a domain with a space in it.

Also often customers enter a domain domain.com in the searchbox ignoring the dropdownmenu for the extention resulting in domain.com.com which then generates an error after it is added to the shoppingcart.

 

How do we get the form to calidate the syntax before it send it to the shoppingcart?

Link to comment
Share on other sites

I assume this is an external form, and not the one within the cart itself? also, it might depend which version of WHMCS you're using and the source of the external form (e.g Wordpress etc). :?:

 

at the most basic, if you use the integration code from WHMCS...

<form action="cart.php?a=add&domain=register" method="post">
Find your Domain: <input type="text" name="query" size="20" />
<input type="submit" value="Go" />
</form>

and are using WHMCS v7.2.2 (though I assume it would do the same for any v7 release) and standard_cart, if you enter 'whmcs2017.com.com' into the search box..

 

rgIqUJm.png

 

... it will attempt to search for it, say that it's not available, and then try to search for whmcs2017.com

 

zJWWPXq.png

 

so v7 seemingly removes invalid characters before searching... if I enter 'whmcs2017 !e.com' into the integration code form, the v7.2.2 cart will search for whmcs2017e.com (removing the space and !)

 

now if memory serves, with v6 and earlier, you have to split the search into sld and tld (where tld is usually a dropdown), so under those circumstances you might be looking at using some javascript to test for invalid characters (space and . being the obvious 2, but there will be others) - i'm sure googling will find plenty of example code to do that... though as I said previously, what you need will be determined by your external form, it's format and your WHMCS version.

Link to comment
Share on other sites

We use the standard WHMCS shoppingcart of 7.1

you don't - that's 'Vertical Steps' and it was removed from WHMCS v6.1 in September 2015 (almost two years ago!) and has not been included in any releases since. :idea:

 

https://docs.whmcs.com/Standard_Order_Form_Templates#Verticalsteps

 

Replaced by the Standard Cart in 6.1. This cart is now deprecated and will no longer receive updates.

 

I daresay it could probably be fixed, though it's been a while since I played with Vertical Steps so no obvious way springs to mind - but it would be a losing battle because at some point, 'Vertical Steps' will be beyond saving... therefore, I suspect you'll need to do two things to make this work going forward...

 

1. update your homepage to include the "Domain Ordering" code from Utilities -> Integration code... it's going to be very similar to the above code except it will include the full URL to the cart... you'll lose the TLD dropdown and, as above, it will just be one text field... the code that you're using on the homepage currently looks like v6 code to me.

2. switch your default orderform template from 'Vertical Steps' to 'Standard_Cart' (or 'Modern' - though 'Standard_Cart' would be the better choice).

 

hopefully, with those two changes, the form should work again... though I appreciate that Standard_Cart will look far different than Vertical Steps!

Link to comment
Share on other sites

I changed the code on the homepage but its not taking the entered domain to the shoppingcart, instead it presents the empty searchbox of the shoppingcart.

Any ideas?

does your url being with 'R'? because if so, and your site is the one i'm looking at, then the domain form on the homepage (outside of WHMCS) hasn't changed - it's still using a dropdown for TLDs... though I can see that the cart is now using Modern.

Link to comment
Share on other sites

It is, but we're testing on index2.html

ah ok, I see what you're seeing now - the problem is going to be this line of code...

 

<input type="text" name="domain" id="domain" class="field4" value="uw gewenste domein!" onblur="if(this.value=='')this.value='uw gewenste domein!'" onfocus="if(this.value=='uw gewenste domein')this.value=''" />

specifically name="domain"... as with the above integration code, it will need to be name="query" - if you make that change, then it will pass the search string to the cart and begin the search. :idea:

 

<input type="text" name="query" id="domain" class="field4" value="uw gewenste domein!" onblur="if(this.value=='')this.value='uw gewenste domein!'" onfocus="if(this.value=='uw gewenste domein')this.value=''" />

 

We did already switch to Modern but run into a problem that once a domain is selected it keeps loading forever.

This is not a browser issue because we receive complaints about this from customers also.

The only extension it seem it does not do that and works normally for is .nl domains...

i'm not seeing this on the site now - though that might have been previously caused by having too many alternate TLDs in the lookups. :?:

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