Microsoft KB Archive/188766

= PRB: Forms 2.0 CommandButton Fires Click Event When Disabled =

Article ID: 188766

Article Last Modified on 10/29/1999

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2

-



This article was previously published under Q188766



SYMPTOMS
The Forms 2.0 CommandButton control can be disabled by setting the value of its Enabled property to false.

When this control is placed inside a table cell on a Web page, the Click event for the control can be fired even though the control is disabled.

The Click event for the control cannot be fired if the control is disabled and placed outside of a table.



CAUSE
The Forms 2.0 controls were designed and tested for use with Visual Basic and Visual basic for Applications, not for Microsoft Internet Explorer.



RESOLUTION
  The recommended resolution for this problem is to use the intrinsic button control by specifying the following HTML:  The following script disables the control when the page is displayed: 

   If you decide to continue using the Forms 2.0 CommandButton control, you can check the Enabled property of the control when handling the Click event, as demonstrated below: 

 



STATUS
This behavior is by design.

<div class="moreinformation_section">

Steps to Reproduce Behavior
The following HTML demonstrates this problem: <HTML> <HEAD> <SCRIPT LANGUAGE=VBScript FOR=Window EVENT=onload>

</SCRIPT> <SCRIPT LANGUAGE=VBScript FOR=MyButton EVENT=Click>

</SCRIPT> </HEAD>

<BODY> </BODY> </HTML>

<div class="references_section">