raido buttons

Creating and using forms
Post Reply
loudog
Posts: 13
Joined: Thu Jan 31, 2008 11:13 pm

raido buttons

Post by loudog »

While creating the database records to contemplate all the possible fields and or seperate tables I may need (in a text editor) I realized :P that a radio button for the "Yes, No, N/A" options for certain questions would be perfect as only one could be selected per the three options. ;) Is this possible :? as there are up to fifteen of these questions on any given report form :D (and there are many different report forms that employees will be filling out on any given day) :shock:

loudog :roll:
User avatar
DrewJensen
Volunteer
Posts: 1734
Joined: Sat Oct 06, 2007 9:01 pm
Location: Cumberland, MD - USA

Re: raido buttons

Post by DrewJensen »

Hi,

The easiet way, IMO, to do this with an embedded database is to use a TINYINT field.

Then on the form you add a groupbox ( found on the more controls toolbar )
Add your 3 radio buttons with labels "Yes", "No", "N/A' and assign the values 1,2,3 respectively.
You set one of these to be the default on the form or not.
To be completely safe on this you might want to restrict the valid entry for the field to only these three values - to do this you would need to use an ALTER COLUMN command.

So assume I have a table named Survey and it has a field Qstn1 of this type.
Open the SQL window ( Tools > SQL ) and enter the following command
ALTER TABLE "Survey" ADD CONSTRAINT "chkQstn1" CHECK( "Qstn1" IN ( 1,2,3 ) )
Click the Execute button.

Now even if you open the table in a datavew window ( no forum ) you will not be able to enter any value other then 1,2 or 3.
Former member of The Document Foundation
Former member of Apache OpenOffice PMC
LibreOffice on Ubuntu 18.04
loudog
Posts: 13
Joined: Thu Jan 31, 2008 11:13 pm

Re: raido buttons

Post by loudog »

OK will experiment on laptop tomorrow 8-) . By the way in my experience with radio buttons if there is a group of them you can only select one as when you select a different one the other automatically turns off. :? Are we on the same page? ;)

loudog :roll:
User avatar
DrewJensen
Volunteer
Posts: 1734
Joined: Sat Oct 06, 2007 9:01 pm
Location: Cumberland, MD - USA

Re: raido buttons

Post by DrewJensen »

Yes, when you use the GROUPBOX control this is the behavior
Former member of The Document Foundation
Former member of Apache OpenOffice PMC
LibreOffice on Ubuntu 18.04
loudog
Posts: 13
Joined: Thu Jan 31, 2008 11:13 pm

Re: raido buttons

Post by loudog »

This works well :D except that the checkbox is more of the look we want as the data input form will be printed out for the customers records :roll: . Is there a way to configure the checkbox icon to act the same way as the radio buttons :mrgreen: ?
loudog :roll:
Post Reply