Dear Filemaker user,
How do I hide a text field when I switch between tabs on Tab control?
Depending on the tab you come from and/or go to, you could use a script to set a global $$variable that you use in the field's Hide condition.
To monitor tab switching and launch that script, use the OnPanelSwitch script trigger for your tab control object, together with the Get ( TriggerCurrentPanel ) and Get ( TriggerTargetPanel ).
Of course, you could also “hide” the field by only placing it into topically pertinent tabs …
Thank you for your answer.
I currently have the following script:
Set Variable [$$PresentielijstTabmonitor;Value Get(triggerTargetpanel)
In "Hide Object When" I wrote the following: $$PresentielijstTabmonitor = "Deel 2"
Because I want a text field to hide when switching from tab 1 to tab 2.
With this code I am not succesful..
Set Variable [ $$PresentielijstTabmonitor ; Value GetValue ( Get ( TriggerTargetPanel ) ; 2 ) ]
because that function
"Returns the index and the object name of the panel to switch to when the OnPanelSwitch script trigger is activated"
It may also be necessary to refresh the display, for which depending on your FM version you could use
Refresh Object [ yourTextFieldObjectName ]
instead of Refresh Window 
Sorry, I am still learning..
I tried entering the function Refresh Object, but I was not able to select the text field "Zat dag"
I did however enter the following values:
I would like to have "Zat dag" shown when "Deel 1" is current and hidden when "Deel 2" is current.
Get ( TriggerTargetPanel ) this function return single value with Next line character. Please follow the below link to download the example db.
Dropbox - Hide_TextField.fmp12
sureshmaas wrote:Get ( TriggerTargetPanel ) this function return single value with Next line character.
Get ( TriggerTargetPanel ) this function return single value with Next line character.
This is not a good approach. If the tab has a name, then substituting ¶ with "" will merge both elements, which is not what you want; if it does not have a name, then there is no ¶, and what you're doing is unnecessary.
In either case, you can get the index number with GetValue ( Get ( TriggerTargetPanel ) ; 1 ). If the tab has an object name, parse it with with GetValue ( Get ( TriggerTargetPanel ) ; 2 ).
As described above, using a name is more robust because it does not change even if you re-order the tabs within the control.
Also you don't need to create a field to hold the value; a global $$variable will do just fine.
A modified file is attached to this post.
sureshmaas wrote:Please follow the below link to download the example db.
Please follow the below link to download the example db.
Speaking of which: if possible, please use the forum feature to attach files to a post; this will ensure that the file is available even if your own hosting space is not.
barand wrote:I tried entering the function Refresh Object, but I was not able to select the text field "Zat dag"
There is no such function; Refresh Object  is a script step that you would put into the same script as Set Variable .
See the attached file in my reply to sureshmaas.
When you say that you tried the 'refresh object' (which is a script step, not a function) what did you put in as the object name to be refreshed? It sounds like you were trying to use the name of the field and not the name of the layout object - these are two very different names. Here's a screen shot that I hope explains the differences.
The above method described by erolst works but I personally prefer to not use global variables with something like this. The "Hide object when" can simply be:
GetValue ( Get ( TriggerTargetPanel ) ; 1 ) = 2
As mentioned if you prefer to use the object names as opposed to their index just change it to be
GetValue ( Get ( TriggerTargetPanel ) ; 2 ) = "tab2" (or whatever Name your give the tab panel)
The script that fires when switching panels can then also be simplified to just a window refresh.
Thank you for the effort guys, I decided to create a radio button and hide certain fields based on the selection within the radio button
Nice idea, but that will run into a snag if there is another tab control on that layout (or probably anywhere in that file, though I didn't test this) that also has an OnPanelSwitch trigger.
I'd rather not rely on internal FileMaker registers for transient data to store the state of UI components.
Retrieving data ...