Tip

Radio Buttons with De-Select

Here's something you've never seen before in Notes: Radio buttons you can turn off! In the radio button control described below, you can make selections just like normal but if you click again on the option that is already selected, you set the field back to the null string, turning off all buttons! This saves you having to add an "N/A" or "None of the above" option and can simplify programmatic evaluation of the field.

One minor quirk: Radio buttons can be selected either by clicking with the mouse, or by moving the cursor into the field and pressing the spacebar. This technique works because the hotspot will be clicked anytime you click a radio button. The same is not true of the keyboard however. You cannot deselect a radio button by highlighting it and pressing the spacebar, however you can get around this by arrowing over just to one side of the radio-button field. If the cursor is right next to the radio button field, it will still be inside the hotspot, so in this position, pressing spacebar will turn off the selected radio button. It hasn't been a problem here, but play with it (with the hotspot border turned on) to see how it works.

To make this work you need three elements:
--The radio-button field
--A hidden, computed for display check field which evaluates to the contents of the radio-button field. This field must appear below the radio button.
--An action hotspot surrounding the radio button field, and with a formula that sets the radio button field to the null string if it's value matches that of the check field. The hotspot should have "Show border around hotspot" turned off, and should have an action like the one shown below.

If the radio button field is called "Choice" and the check field is called "Chk_Choice" then the hotspot should have this formula:
FIELD Choice:=@If(Choice=Chk_Choice;"";Choice);
@Command([ViewRefreshFields]);
@All


This was first published in November 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.