Submit form and disable submission button I want to disable the submit button after it is clicked to prevent multiple submissions. I have:

$form['show'] = [
'#type' =&gt; 'submit',
    '#value' =&gt; $textforsubmitbutton,
    '#name' =&gt; 'submit',
    '#attributes' =&gt; array("onclick" =&gt; "javascript: this.disabled = true;"
    ),
];


but this disabled the button completely. Using "onsubmit" in place of "onclick" doesn't change anything on the button. So maybe I need something like:

    '#attributes' =&gt; array("onclick" =&gt; "javascript: this.submit; this.disabled = true;"
    ),


How do i fix this?
For those wanting to disable the form submit button on load, try this:

$form['actions']['submit']['#attributes']['disabled']  = 'disabled';