Jump to content

Yes or No Checkbox


This topic is 3186 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I remember doing this in the past but just plain forgot the method.

I have a "text" on a layout which asks for one of two checkboxes to be selected (i.e. Answer=  Yes No).  As it is now, both checkboxes can be shown as "checked" (or "not empty).  I want it to be set up so that if "yes" is checked and then later "no" is checked, the checkmark in "yes" will disappear.  In other words, only one of the two boxes can be checked.

 Additionally, could there be a third box (i.e. Answer= YesNo N/A) which would work the same way with only one being able to show a checkmark.

Link to comment
Share on other sites

You can use the auto-enter calc 

GetValue ( Self ; ValueCount ( Self ) )

to have the field automatically be set to the last checked value. 

Note that the metaphor of Checkboxes is to accommodate multiple values; what you want are actually Radio Buttons.

Edited by eos
Link to comment
Share on other sites

Hi Michael,

Agree with eos (and Miss A) that the Radio Button set is the correct UI device for mutually exclusive choices.  Note that in FileMaker, a user can choose multiple options even in Radio Button sets by using the Shift modifier key, so eos' auto-enter calculation is an essential tool to keep in your toolbox whenever enforcing single values is paramount.

That said, for Boolean "Yes/No" fields (putting aside the "threee-value logic" Yes/No/NA case you mentioned), the simplest UI approach is often a single checkbox, where the checked/unchecked state represents your "yes" and "no" values respectively.

My approach for handling this is to place a single checkbox on the layout tied to a "Boolean True" value list with only the single value "True" (or 1), hide the value itself — the field label will identify the semantic meaning of the control — and set the field to this auto-enter calc:

GetAsBoolean ( Self )

I also auto-enter data (either 0 or 1) to set the default value for new records.  This way checking/unchecking the box will toggle the value between True and False, and the multiple-value problem is eliminated.

Link to comment
Share on other sites

Y'all are great.  Didn't even think about the radio button thing.  It works perfect (created two value lists, one be yes and no and the other being yes and no and n/a.  When a new record is created the two (or three) items show up as desired (an empty ☐).  Checking any button/box places the button there, which is fine because it doesn't really need to be a √ checkmark.  

However, once one of the buttons is selected it cannot be deselected except by checking the adjacent box which puts the button there.  Is there any way to clear the boxes completely?

Also, the boxes (buttons) show up about with 60-65 points spacing.  Any way to reduce that to, say, 25 points?

Link to comment
Share on other sites

personally i would create the field that holds the value either [ 0 | 1 | 2 ]  and then assign meaning to these

0 = NO
1 = YES
2 = N/A

For a simple boolean toggle Abs ( table::fieldName - 1 )  is a great way to do a toggle a boolean value.

And of course you need to assign the field to auto inter your desired default value since a NULL value is yet another option. That is if you require the value to be filled. 

I would use buttons on the layout to either explicitly set the value or use a toggle script. Then using the inspector you can toggle the visibility of the button object to in effect provide you a toggle.

example 

http://www.seedcode.com/filemaker-13-animations/

Link to comment
Share on other sites

created two value lists, one be yes and no and the other being yes and no and n/a.

That would make sense only if the field is supposed to have four states (empty, Yes, No, N/A) or if the field is not supposed to be ever empty. Judging by what you say next, that's not your situation.

 

However, once one of the buttons is selected it cannot be deselected except by checking the adjacent box which puts the button there.  Is there any way to clear the boxes completely?

You can place the cursor inside the field and press Delete. Or use a button to set the field to empty.

 

Also, the boxes (buttons) show up about with 60-65 points spacing.  Any way to reduce that to, say, 25 points?

I don't think so, but you can always design your own look using buttons and conditional formatting. The field itself doesn't even need to be on the layout.

 

 

 

 

For a simple boolean toggle Abs ( table::fieldName - 1 )  is a great way to do a toggle a boolean value.

Is it? I believe:

 not Table::FieldName

is both simpler and more ... Boolean-like?

Edited by comment
Link to comment
Share on other sites

However, once one of the buttons is selected it cannot be deselected except by checking the adjacent box which puts the button there.  Is there any way to clear the boxes completely?

Shift click will deselect any selected radio button option

Link to comment
Share on other sites

This topic is 3186 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.