Copied to clipboard

Flag this post as spam?

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


  • Lungelo Keswa 16 posts 97 karma points
    Aug 31, 2023 @ 13:01
    Lungelo Keswa
    0

    hide submit button after it has been clicked

    hi i am currently using umbraco 11 forms i have 5 fields in the forms i would to know if it is possible to disable the submit button or hide the button after it has been clicked and after the user has added their details

    enter image description here

    enter image description here

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Aug 31, 2023 @ 15:11
    Huw Reddick
    0

    you could maybe add some javascript to your view to hide/disable it when the button is clicked

  • Lungelo Keswa 16 posts 97 karma points
    Sep 01, 2023 @ 06:54
    Lungelo Keswa
    0

    hi there is no way to add an onClick attribute to these buttons wanted to add that here i can't even get an ID in these buttons that's my issue

    enter image description here

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Sep 01, 2023 @ 07:14
    Huw Reddick
    0

    You don't need an id in order to trap an on click using javascript. You can use it's class as the selector. You could do something like this

    $('input[type=submit]').click(function() {
        $(this).attr('disabled', 'disabled');
        $(this).parents('form').submit();
    });
    
  • Lungelo Keswa 16 posts 97 karma points
    Sep 01, 2023 @ 07:22
    Lungelo Keswa
    0

    Wow why was i over thinking this

    thank you man appreciate this

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Sep 01, 2023 @ 09:07
    Huw Reddick
    0

    Yes, as developers we do tend to overthink things sometimes :D

  • Luuk Peters 85 posts 331 karma points
    Sep 01, 2023 @ 10:12
    Luuk Peters
    0

    And if you want to be more specifically target the Umbraco submit buttons, you can also select them based in their data attribute:

    var umbracoSubmitButtons = document.querySelectorAll(input[data-umb='submit-forms-form']);
    

    (I prefer to use vanilla javascript and hardly ever use jQuery anymore). Make sure that all conditions are met before disabling the button obviously. For instance, when someone has not checked the 'consent' checkbox, I guess the form should not submit and you should not disable the button.

  • Lungelo Keswa 16 posts 97 karma points
    Sep 01, 2023 @ 10:25
    Lungelo Keswa
    0

    Yeah cool cool man i understand thanks for this info really appreciate it

Please Sign in or register to post replies

Write your reply to:

Draft