Get value of focused dataprovider?

Hi, easy one:

I need to get the value of the focused dataprovider. In this case, I have a script running on the onAction of a checkbox. The script needs to check whether it is 0 or 1, and it needs to be generic so I can put the same script on several different checkboxes.

So I need a function like getValueOfFocusedDataProvider or GetValueOfSelectedElementName.

The filemaker equivalent of Get(ActiveFieldContents).

Anything like this?

Thanks!

Andrew

By heart application.getMethodLastElementTriggerName or something like that. In the application tree.

Is documented btw…

I think this is currently not that easy. You will have to do something like this:

var vElement = application.getMethodTriggerElementName(); // get the name of the element
var vRecord = foundset.getRecord(foundset.getSelectedIndex()); // get the record
var vValue = vRecord[elements[vElement].getDataProviderID()]; // get the value of the column

Recommend using naming conventions. If the field is called “name_last” I would name it “fld_name_last” and attach a variation of this code:

var trigger = application.getMethodTriggerElementName() //get the object name

var formName = application.getMethodTriggerFormName() //get the form name so you can use anywhere

var fieldName = trigger.substr(4)

forms[formName][fieldName] = null //assign a value to the field

forms[formName].elements[trigger].requestFocus() //request focus back to the field