set fieldname(value) in argument for global method

HI

I have global method with two arguments:

function myGlobalmethod (vEvent, vValue) {
//blahblah do stuff here
}

wonderfull.
On a form, a I put this global on a button, the Events auto appear, I can fill in a value into vValue, wonderfull!
but is it possible to fill in a fieldname into the vValue, so that Servoy looks for that fieldvalue, and than passes me that?
Everything I tried, is converted into a string… so I always get the fixed string there.

Maybe I’m missing something, don’t know, that’s why I ask here :-)

so, since you have the fieldname as string + the event

can’t you determine the value in the method itself?

forms[vEvent.getFormName()][vValue]

that’s true, but I want to set it PER form

the fieldname and so the fieldvalue, is different per form or even can be different per button…
I tried %%myfieldname%% but that does’nt work either…

oke answering my own question: no you can’t set a fieldname right away
but with a small work around you can get the value:

vValue = forms[vEvent.getFormName()]controller.getDataProviderValue(vValue)

so you really send the columname as a string to the global method…
works for me… ;-)

EDIT: the tip of Marc is doing exactly the same, :-) thx Marc. need some more sleep ;-)

Harjo:
need some more sleep ;-)

Just another tip: postpone your workday to the evening. Then you’ve had your sleep… :lol: :lol: