J-B Posted October 8, 2019 Share Posted October 8, 2019 Hello, Unfortunately, I have to open a new topic because the other one was closed. The code from @brian!, to get a checkbox for GDPR reason is not working anymore in WHMCS 7.8.x. Does anyone have an idea why? <input type="checkbox" required name="gdprconsent" oninvalid="this.setCustomValidity('{$LANG.ordererrords}')" oninput="setCustomValidity('')"> I consent blah blah 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 8, 2019 Share Posted October 8, 2019 6 hours ago, J-B said: The code from @brian!, to get a checkbox for GDPR reason is not working anymore in WHMCS 7.8.x. Does anyone have an idea why? there must be increased validation somewhere, because if you take that entire form code and add it to another template, it works fine and the checkbox is highlighted... just not on the client register page.. 🙄 using a CCF would almost certainly work (not least cos you could set it to required and WHMCS would comply), but you probably don't want to do that (it would mean rejigging the template)... possibly there is a hook solution, will need to have a think about it. 🤔 0 Quote Link to comment Share on other sites More sharing options...
J-B Posted October 9, 2019 Author Share Posted October 9, 2019 FYI this hook isnt working too. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 9, 2019 Share Posted October 9, 2019 4 hours ago, J-B said: FYI this hook isnt working too. aah that's fundamentally John's coding, though he at least had the foresight to put the disclaimer in that it might not work with future versions... 🙄 Quote This hook was tested with the current versions of WHMCS that fall under Active Support as listed at https://docs.whmcs.com/Long_Term_Support#Active_Development and is not guaranteed to work with prior or subsequent versions of WHMCS. you could use JS to disable the submit button if the checkbox isn't ticked.... <?php add_hook('ClientAreaFooterOutput', 1, function ($vars) { if ($vars['filename'] != 'contact') { return false; } $output = '<div class="text-center"> <label class="checkbox-inline"> <input type="checkbox" name="additional" id="additional" value="1" required /> I can confirm I have read and agree to the <a href="https://www.example.com/" target="_blank">Demo Agreement</a> </label> </div> <br />'; return '<script> jQuery(\'.btn-primary\').before("' . preg_replace( "/\r|\n/", "", str_replace('"', '\"', $output)) . '"); $(\'#additional\').change(function () { $(\'#submit\').prop("disabled", !this.checked); });</script>'; }); but as it stands, it would only work if you edited contact.tpl and gave the submit button an ID... <button type="submit" id="submit" class="btn btn-primary{$captcha->getButtonClass($captchaForm)}">{$LANG.contactsend}</button> ... unless you use the Class instead and get the current captcha button class to the coding, or hard code it the captcha settings specifically for *your* site.... $(\'.btn btn-primary btn-recaptcha btn-recaptcha-invisible\').prop("disabled", !this.checked); there is one slight weirdness to the way it works - but it will work... though possibly a pure PHP hook solution would give a more coherent appearance... so think of this as a temporary sticking plaster until inspiration hits me. 0 Quote Link to comment Share on other sites More sharing options...
J-B Posted October 10, 2019 Author Share Posted October 10, 2019 Thank you, it works! But, for me, the matter has settled. The contact form is not compatible with the ticket system. If the e-mail is imported in the ticket system, the sender is not displayed. For WHMCS ist not a bug, it is a feature. 👏 I redirect my contact Site to the WordPress Site, in WordPress it works fine. 0 Quote Link to comment Share on other sites More sharing options...
Azar-A Ltd Posted October 20, 2019 Share Posted October 20, 2019 Just add a required field of type checkbox for your clients with the text you need. 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.