DennisHermannsen Posted January 4, 2019 Share Posted January 4, 2019 Is it possible to have regex validation on some fields from additionalfields.php? 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 4, 2019 Share Posted January 4, 2019 On 04/01/2019 at 10:47, DennisMidjord said: Is it possible to have regex validation on some fields from additionalfields.php? from admin configuration settings, no; from options within additionalfields, no. https://requests.whmcs.com/topic/additionaldomainfields-validation it can be done by editing the template and, by implication, with an action hook too... for example, I could apply a minimum and/or maximum length to a field using HTML5 patterns... as i've done in other threads, I could make that error message in the client's own language if necessary. this was done with a quick IF statement in the template, but effectively you're just manipulating the $domain.fields array, so that's why I know you could do it as a hook if you wanted to. you could even regex VAT ID fields if you had to for the correct format for each country - though note that it's just checking formats, and not querying the actual VAT number with VIES to check whether it exists. if I remove the spaces from WHMCS' VAT number, then the regex would pass successfully and the order can continue. I assume that there are no additionaldomainfields validation options in the v7.7 betas ? i'm not installing the RC until at least next week, so I don't know but saw nothing in the changelogs. if you were validating multiple fields for multiple TLDs, then you may be better off with a hook to avoid complicated if statements in the template... but either way, this could very easily get very messy very quickly - not least because you'll have to check the TLD before modifying the array fields - and as there's no specific TLD field, you'd have to create it from other variables... there could be other issues that haven't even occurred to me, so this could be an absolute minefield if you really want to start validating these fields! ⚠️ it might be useful for me to have 3 practical TLD examples where this could be used. 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.