Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Intermediate
Nov 29, 1999

Unselect All Radio Buttons in Visual InterDev

When the Visual InterDev Scripting Object Model (SOM) creates an option group object (a set of radio buttons), it selects the first radio button when the page loads. You may not want to "influence" the user's choice by allowing a default selection.

Although there's no way to unset this default property using the design-time control, there is a method. You can use VID's onbeforeserverevent, the firstentered property, and a little JavaScript to unselect all the buttons when the page first appears. The following code inserts a call to the clearopgp() function into the <BODY> tag only if this is the first time the page has appeared. This code snippet assumes that you have included the VID PageObject DTC in your ASP page.

 
<SCRIPT LANGUAGE=javascript>
<!--
function clearopgp() {
document.thisForm.OptionGroup1[0].checked=false;
}
//-->
</SCRIPT>

</HEAD>
<BODY
<% if thisPage.firstEntered=true then
Response.Write " onload=" & chr(34) & "clearopgp();" & chr(34)
end if
%>
>

Note that the final > in the code snippet is important because it completes the <BODY> tag.

Ken Cox
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date