Is there a way to have a condition disable a field?
There are quite a few options all possible in FileMaker.
Disable the field so that the user can't see the data in it?
Keep them from copying data to the clipboard from a "disabled" field?
Keep them from modifying data in the field?
Disable the filed only for specific users?
Only for certain values in another field?
You can also make fields appear an disappear from your layout instead of appearing "disabled".
i would like the field to disapear from the layout when under certain conditions. the user should not be able to input data into the field nor should they see it.
Since I don't know what those "certain conditions" might be, I will simply share a demo file created in.fp7 format that illustrates several means that can be used to make a field disappear. If you are using FMP 12, you can open it from the file menu to get a copy that works in v12.
Feel free to ask follow on questions after examining the file.
how would i go about using the portal to hide a field?
i have a radio button set with the values 1, 2, 3, 4, 5, 6
depending on which button is selected is what determines how many of a field is shown in the layout. (either 1-6)
is the portal the best tool to achieve this?
That seems like a less than optimum design. Why not use a portal with 6 rows for entering the data?
Sticking with your original concept, You would need 6 one row portals on your layout all with different relationships.
Say your layout's table has a field: LayoutTable::_pkLayoutTableID set up an as an auto-entered serial number to uniquely identify each record in that table.
LayoutTable::__pkLayoutTableID = LayoutTablev1::__pkLayoutTableID AND
LayoutTable::constOne = LayoutTablev1::RadioButtonField
LayoutTablev1 is a new occurrence of the same data source table as LayoutTable. This is called a 'self join' and links the table to itself.
constOne would be a calculation field defined to always return the value 1.
Then you can place a one row portal to LayoutTablev1 on the layout and place Field 1 in this portal row.
Repeat for each field, adding both another table occurrence and another const calculation field for each additional field.
On the other hand, you might set up an invisible tab control with 7 tab panels with 0 - 6 fields on each tab panel--or a portal where the number of portal rows is different on each tab panel.
and if i were to use the tabs how do i set that up?
the fields are very close to each other in a vertical line. could the tab still work?
the fields are very close to each other in a vertical line.
Which strongly suggest that you need a portal here instead of 6 different fields.
Put no fields on the first tab.
Put 1 field (or a one row portal) on the second tab
Put 2 fields ( or a two row portal) on the third tab.
Use the position tab with pixels or pts selected as units to precisely position the fields so that any objects on more than one tab don't "twitch" when a different tab is selected.
Hmmm, in FileMaker 12, you could make the tab control visible and number the tabs 0 - 6. Instead of clicking a radio button, they click the tab. A script trigger on the tab panel can then store the number so selected in a field so that this panel is automatically selected the next time the user brings up this particular record.
OnRecordLoad, BTW, would use a script with Go TO Object to select the appropriate tab.
what would i have it "Go To"? how exactly do i tell the script which tab to the correct tab?
The demo file is set up to illustrate giving object names to tab panels.
Enter layout mode and select each tab panel one at a time. (Click the tab control once to select the tab control. Click it again to select a panel within the selected tab control, but don't click so fast that you double click it and get Tab Control Setup...) With a given tab panel selected, enter an object name for it in the name box found on the position tab's name box. Then use that name in a go to object script step to select that tab panel.
Thus, if you name a tab panel "one", go to object ["one"] will bring that tab panel to the front.
If you are using FileMakerk 12, you can select the OnTabSwitch script trigger to perform a script that updates a value in a field to keep track of which tab should be selected. This script can use Get(TriggerTargetTabPanel) to detect which tab panel was just clicked.
Set Field [YourTable::CurrentTab ; GetValue ( Get(TriggerTargetTabPanel) ; 2 ) ]
Would store the selected tab's object name in CurrentTab and then:
Go To Object [YourTable::CurrentTab]
will pop that tab panel to the front.
If you are using a version of FileMaker earlier that 12, you can still identify the clicked tab, but you have to use OnObjectModify and a much more combersome script with GetLayoutObjectAttribute to do so.
great! i got the tabs to work how i like them.
i have a script that runs when the layout is entered which checks to see which radio button was checked.
it then takes that number and chooses the correct tab to go to.
so all works fine except i would like the user not to be able to select their own tab.
is there a way to disable the tabs or hide them or shrink them really small?
i made all the tabs invisable but i would just like to make sure it doesnt get tampered with.
Give your tab labels a width of 0 in tab control set up...
perfect! works great! thanks!
Retrieving data ...