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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to disable the button after one press

(0) ShareShare
ReportReport
Posted on by 534

Hi Guys,

How to disable the button automatically,after the button is clicked once.

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: How to disable the button after one press

    As Will WU wrote, you need to save information "Is this record submitted?" and use this information to enable/disable the button. Otherwise the button would be enabled if the user closed and reopens the form.

    So, here's the solution:

    1) Add boolean/checkbox field "Submitted" to your table

    2) When the submit process is done (NOT when the button is clicked but when the process is really done succesfully!) update "Submitted" field to "Yes"

    3) In Active method of your form data source, enable/disable the button based on the value of the Submitted field.

    4) Set property "Auto refresh data" to Yes in your Submit button. This will make sure that the button is disabled once the submit process is completed.

  • Verified answer
    WillWU Profile Picture
    22,361 on at
    RE: How to disable the button after one press

    Hi jenifer,

    If it is a custom form, you can add an enum field to the data source and write in onactive() method of the data source(Code provided by Nikolaos).

    You need to change the value of the enum in the button's onclick method and determine the availability of the button based on the value of the enum.

    Hope this helps.

  • Adam123 Profile Picture
    534 on at
    RE: How to disable the button after one press

    Example-

    I have "Submit" Button

    when I click the submit button , it should be submitted only once and then the submit button should be disabled.

    The button should be clicked once,not for the second time.

  • WillWU Profile Picture
    22,361 on at
    RE: How to disable the button after one press

    Hi jenifer,

    What's your requirement?

    Just writing an event post handler may not be enough. Does the status of the form change? Do you need to press the button when you open the form again?

    If you need to determine the availability of the button based on states, you can code in the onactive() method of the data source.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: How to disable the button after one press

    You can hook in the clicked method of the button. This way you can execute your code when the button is clicked.

    Code for disabling a button would look like:

    ButtonName.enabled(false);

    Please note that you need to set AutoDeclaration to Yes for your button so that you can easily refer it from your code.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,257

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 913 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 611 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans