Field without name. Can I get it's dataProvider?

Hello,
I am working on an application which has many forms and on each form many fields without a name.

I am having trouble because I want to find out the dataProvider of the focused field.
I am using the onElementFocusGained event to find out that an element has been focused.
My trouble is that I don’t know how to retrieve the element’s dataProvider without a name.

Is this possible? Or am I asking for an impossible?
Thanks in advance and regards,
Miguel.-

In the onFocusGained method you get an event as the first argument, you should be able to get the dataprovider like this:

event.getSource().dataProviderID

Having said that, why wouldn’t you give your fields a name?

Great, thanks a lot.
We didn’t use to name fields unless we wanted to use them in our code.

It is obvious that it was an error. From now on, we’ll name every field.

If you want, you can make a method that fills all the names in Servoy 6.

You have to loop through your forms and set the names of the fields that have none, using the solutionModel.
Then to save it, you have to go to the Command Console and do:```
servoyDeveloper.save()

That is more than expected.
Thanks a lot, Joas. We’ll certainly do it.

By the way, I am testing your code

event.getSource().dataProviderID

Is this maybe a new feature on Servoy 6?
It doesn’t seem to work on Servoy 5.2.8

I got the right one, Joas:
Instead of event.getSource().dataProviderID we need to use event.getSource().getDataProviderID()
Thanks again for the clue.