Radio button actuating a text box

Is it possible to create a radio button and when it is checked have it open a text box? I’d like to have a Married yes/no radio button that if clicked it will drop down a Spouse Name text box and add the spouse’s name to the database.



You can sort of do this using macro code. You can set the Visible property of the text field to Yes or No depending upon the setting of the radio button group (use group so only one selection allowed). If you know macros this is fairly simple. If not, learning to code macros is quite a task. Many thing to cover especially in Base.

Personally, I am not sure of the benefit. If you select Yes but don’t enter a name, what then? You can always use SQL (a query) to check for records with incorrect entries such as: Married set but spouse = NULL (or vice versa).

Edit 2018-06-19:

To illustrate a working sample with macro ------ RadioButton.odb

For information on coding macros there are many sources such as the LO docs → LibreOffice Base Handbook.

The most definitive source for macros is OpenOffice Macros Explained (OOME) by Andrew Pitonyak found here → OOME PDF.

For more, see this post → To learn LibreOffice Base are there introductions or tutorials?

If this answers your question please tick the :heavy_check_mark: (upper left area of answer). It helps others to know there was an accepted answer.

I found Access2Base->PropertiesSet->setVisable but now how can I edit it? I write C code for microprocessors so I’m kind of falling back on that.

I would think when the Married Radio button changes state I need to 1st, see if the button is set or cleared then 2nd, if it is set I setVisible the SpouseName field. If the radio button is cleared I want to clear the text value of SpouseName then clear the Visible property of the SpouseName field.

Is this how I’d do it?


I’m not finding anything on how to write macros for libreoffice base.