Ragonz Posted June 11, 2018 Share Posted June 11, 2018 Yesterday we had someone sign up with a last name of ; this caused our product platform to not create an account as it could not create a username with ; in it, is there a way to prevent certain characters being used in the first/last name fields of WHMCS? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 12, 2018 Share Posted June 12, 2018 11 hours ago, Ragonz said: Yesterday we had someone sign up with a last name of ; this caused our product platform to not create an account as it could not create a username with ; in it, is there a way to prevent certain characters being used in the first/last name fields of WHMCS? the usual two ways would be to.. edit the checkout/register templates and add a html5 pattern to those two fields in either/both templates - should literally be only one line of code per field. <input type="text" name="firstname" id="inputFirstName" class="field" placeholder="{$LANG.orderForm.firstName}" value="{$clientsdetails.firstname}" pattern="[a-zA-Z ]+" oninvalid="this.setCustomValidity('Please use valid alphanumeric characters')" oninput="setCustomValidity('')" {if $loggedin} readonly="readonly"{/if} autofocus> so in the above example, i've coded the error message in English, but you could equally use a language string in that code to ensure the error was shown in the clients language.... for surnames, you will probably have to extend the pattern to use ' and - etc. use a ClientDetailsValidation action hook to check the format of those fields and return an error message if applicable. 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.