AnsweredAssumed Answered

Toggling Checkboxes On and Off

Question asked by bnation83 on Jan 3, 2012
Latest reply on Jan 6, 2012 by comment

I have a check list/observation form that runs in FM Go on an iPad. Due to the number of items on the form and that the end user want's it to look as close to the paper form as possible the check boxes are somewhat small. So I am attempting to write a script for a button that that will toggle on/off each check boxes. The "check boxes" are boolean with a value list of "1". I don't what to have a super long script with a case statement for each checked item/field. I'm passing the file name via a variable and also passing each check box name (the actual field name) via the Get (ScriptParameter). Both seem to be getting passed correctly. Because of this I need to use the Set Field By Name function. When I use run a version of the script using the actual field names and the Set Field the toggling works. When I put the variables back in it only toggles one way depending on if my IF statement is "not isEmpty(field)" or "isEmpty (field)". I have tried using global variables ($$) or local variables ($).

 

Here's the script.

Set Variable [ $FileName; Value:Get [ActiveFieldTableName) & "::"]

 

Set Variable [$CheckBox; Value:Get(ScriptParameter)]

if [not IsEmpty ($FileName & $CheckBox )]

Set Field By Name [$FileName & $CheckBox; ""]

Else

Set Field By Name [$FileName & $CheckBox; 1]

End If

 

Any suggestions would be greatly appreciated.

Brad

Outcomes