Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    May 01, 2018 @ 10:49
    Ismail Mayat
    0

    Conditionally enable submit button

    I am using latest umbraco forms. One thing I want to do is, prevent users from submitting the form until they tick 3 checkboxes for terms and conditions.

    Any suggestions on the best way todo this?

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    May 01, 2018 @ 11:54
    Ismail Mayat
    0

    ok so just put some code into my template:

    <script type="text/javascript">
        $(document).ready(function() {
            $('#submitbtn').attr('disabled', 'disabled');
            var checkBox = 'input[type="checkbox"]';
            $(checkBox).change(function() {
    
                if ($(checkBox + ':checked').length === $(checkBox).length) {
                    $('#submitbtn').removeAttr("disabled");
                } else {
                    $('#submitbtn').attr('disabled', 'disabled');
                }
            });
        });
    </script>
    
Please Sign in or register to post replies

Write your reply to:

Draft