PRB: OptionGroup DTC Does Not Respond To OnChange EventID: Q200105
|
When clicking on an OptionGroup Design-Time Control (DTC) whose Scripting Platform is set to "Server (ASP)," the OnChange event does not fire immediately. Specifically the OnChange event does not fire until the control has lost its focus.
The OnChange event of a Radio Button control does not fire until the Radio Button control has lost its focus. Since the OptionGroup DTC essentially uses HTML Radio Button controls to implement its OnChange event, the event handler for the OnChange event is not called until the user clicks outside the Radio Button control.
To allow code to respond immediately to user input for the OptionGroup DTC, you can use the OnClick event for the Radio Button control. Since the OnClick event is not an event available to the script object of the OptionGroup DTC, you can use the advise method to register this event.
Use the following steps to do so:
<SCRIPT LANGUAGE=javascript RUNAT=server>
function thisPage_onenter(){
OptionGroup1.advise("onclick",OptionGroup1_onclick);
}
</SCRIPT>
<SCRIPT LANGUAGE=javascript RUNAT=server>
function OptionGroup1_onclick(){
var temp;
temp = OptionGroup1.getValue();
if (temp==1){
Response.Write ('Option1 selected');
}else if (temp==2){
Response.Write ('Option2 selected');
}else{
Response.Write ('Option3 selected');
}
}
</SCRIPT>
This behavior is by design.
Q193229 BUG: Onchange Unavailable in VBScript with OptionGroup DTC
Additional query words:
Keywords : kbCtrl kbScript kbVisID600 kbGrpASP
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: March 21, 1999