How to preselect a value in a radio button field in Notes Client

Environment:I have created a form with the special fields “SaveOptions” and “MailOptions” both set to 0, cause I want that documents created with that form only get saved via a customized save action. When opening the form, it is opened directly in edit mode via “@Command([EditDocument])” in the OnLoad Event of the form.

Concerned Fields:

On this form is a Radio Button field A, which gets its values from a hidden field B on the same form. Field B is a multivalue field. This works fine so far.

Sense of the Radio Button:

The Radio Button field is just for displaying and browse values in hidden fields. It is not meant for saving values. So documents created with this form never have a value in the Radio Button field A.

The Problem:

Today, when the form opens up, all values from hidden field B are displayed as options in the Radio Button field A, but none is selected. Users have to select desired values, even if there is just one option in the Radio Button field A.

What I want:

  1. Determine one value from hidden field B through calculations

  2. Set this determined value of hidden field B as the selected one in the Radio Button field A when the form opens up.

How can I set the selected option of a Radio Button filed in Domino Designer?

Subject: You just have to assign field A to the value you want.

Exactly how you would do that, depends on where you have code already and what language it’s in. But you probably would do the assignment in the same code where you assign field B.

If this is not enough information to answer your question, you might add detail to your question so people could be more specific. See CRISPY link below.

  • Andre Guirard, IBM/Lotus Development

Useful blog: Best Practice Makes Perfect

NOTE: My policy is to post only two responses to the same question. So that my second response can solve your problem rather than being a request for details, please read the C R I S P Y document.

Subject: How to set the selected option in a radio button field

In the options of the radio button field itself on the second tab called “Control” is a section called “Choices”. There I chose “Use Formula for choices” and wrote the field name of the hidden field B. The result on opening the form is, that all values in hidden field B are visible as options but none is selected. Unfortunately I do not know any way of defining which of the option is preselected. There is no configuration possibility in the the properties of the field. Nor can I see a way to set it via LotusScript and the representing NotesItem object of the radio button field. In Javascript for the web exists the possibility to explicitly set the selected option of a radio button field. Is this possible via Formula language or LotusScript too?

Subject: radio buttons

In Notes radio buttons are just normal fields in terms the value they store. You can set it using document.radiobutton = “x” in lotusscript

Or, as with other fields, use the default value or translation formula to calculate the value

Subject: Perfect :wink:

Your solution helped.

The values of the hidden field B I use as options in the radio button field where in the format “Text | Index”, where Text is a string and Index a number. Example “Servername Bla Bla | 1”.

I tried now as a test to set in a hard coded value in the “Default value” field of the radio button. When I set the whole value “Servername Bla Bla | 1” it does not work, when I just set the Index, it does not work, but when I just set the Text part of the whole value then I see the respective button is selected.

All values in subsequent fields which depend on the selection in the radio button filed can be recalculated in the OnLoad Event of the form by “@Command( [ViewRefreshFields] )”

Thank you very much!