web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Prevent a Button From Being Double-Clicked?

(0) ShareShare
ReportReport
Posted on by

Hi all,


We are using an on-premise 2013 solution and have added a custom button to a form (using Ribbon Workbench).  On click, this button calls a javascript function.


We now have a user who is double-clicking this button because they believe it is going to make things faster, but doing this is making the javascript fire twice.  We realize this is a user behaviour issue and are taking steps to address it, but we're also looking at a way to keep this from happening at a system level.

Has anybody encountered something similar and found a solution for it?

Thanks for any advise you can offer.

*This post is locked for comments

I have the same question (0)
  • Aileen Gusni Profile Picture
    44,524 on at

    Chris

    That is the common issue especially if you dont have enable rule function and also you dont refresh the ribbon after you click it.

    You need to make sure in backend level such as you set javascript to always refresh aft click.

    And also in plugin to prevent it by lets say your ribbon is to create new record then you check you have existing record or not before processing.thanks

  • pasargard58 Profile Picture
    185 on at

    Hi Chris,

    I had similar issue which I fixed it by simply put a flag on JS method. This flag is set to false initially and the method will set it to true for the first executing time. Then inside the method check if the flag is true do nothing.

    Hope that helps.

  • Suggested answer
    Rajat Awasthi Profile Picture
    675 on at

    Hi Chris ,

    To Overcome this , you will need to have some fields (say Boolean) of the form.

    Once the user clicks the button , make that field true or false and return false.

    this needs to be called under display rules in RWB solution.

  • Suggested answer
    NatrajY Profile Picture
    3,040 on at

    You should wrap your click handler with another function that will ensure that it is called only once. You can use lodash once (https://lodash.com/docs/#once) or this simple implementation -> davidwalsh.name/javascript-once if you don't want to use lodash.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans