Jump to content

Checkbox for GDPR - v7.8.x


J-B

Recommended Posts

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

 

Link to comment
Share on other sites

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. 🤔

Link to comment
Share on other sites

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);

XDnHTwo.png

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks 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