Retrieve the name of an object in a method


#1

Hello,

I would like to assign a method to two objects in a form and make a condition on their name:

If $evm.object[‘name’] == 'textbox1’
$evm.object[‘visible’] = true
else
$evm.object[‘visible’] = true
end

how to recover this value?
I am open to any proposal if my approach is not good

Thank you for your help.


#2

You need to create an instance to call the method from a form in any case. Create 2 instances calling to the same method. Assign each instance to the corresponding form items.

You can get the name of the calling instance by $evm.root['object_name'] so you will know which item instantiated it.

Just tried and the following code writes the name of the instance back to the textbox (just for fun):

$evm.object['value'] = $evm.root['object_name']

HTH


#3

xian,

Thank you for your help

that work !