# Data field name from data changed event

**URL:** <https://forum.servoy.com/t/data-field-name-from-data-changed-event/16370>\
**Category:** Classic Servoy\
**Created:** [August 20, 2012, 2:17pm UTC](https://forum.servoy.com/t/data-field-name-from-data-changed-event/16370 "2012-08-20T14:17:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![udrescu\_bogdan](https://avatars.discourse-cdn.com/v4/letter/u/87869e/32.png) [@udrescu\_bogdan](https://forum.servoy.com/u/udrescu_bogdan)\
**Post date:** [August 20, 2012, 2:17pm UTC](https://forum.servoy.com/t/data-field-name-from-data-changed-event/16370/1 "2012-08-20T14:17:49Z")

</div>

Hi guys!

I want to force some of the fields to uppercase. I can set the format to UUUU, but I don’t want to do that because sometimes user gets stuck when the field is validated (the text becomes red).

So I have the option to set it to uppercase when the data change event occurs. The thing is that I need this for several fields and I need to know the name of the field in the event method, so I can use only one method implementation. I would like to get the name of the database field from the event object, but I don’t know how and also it might not be available.

Does anyone know how to obtain the name of the database field on a data change event method in an elegant way?

Thanks a lot!  
Bogdan.

---

<div class="post-metadata">

**Author:** ![ptalbot](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/ptalbot/32/4952_2.png) [@ptalbot](https://forum.servoy.com/u/ptalbot)\
**Post date:** [August 20, 2012, 2:54pm UTC](https://forum.servoy.com/t/data-field-name-from-data-changed-event/16370/2 "2012-08-20T14:54:08Z")

</div>

You need to give your field a name, then in the onDataChange event handler, you can do:

```auto
var formName = event.getFormName();
var elementName = event.getElementName();
if (elementName) {
    var frm = solutionModel.getForm(formName);
    var elem = frm.getField(elementName);
    var dataProvider = elem.dataProviderID;
    // do whatever you want with that dataProvider value...
}

```

---

<div class="post-metadata">

**Author:** ![udrescu\_bogdan](https://avatars.discourse-cdn.com/v4/letter/u/87869e/32.png) [@udrescu\_bogdan](https://forum.servoy.com/u/udrescu_bogdan)\
**Post date:** [August 20, 2012, 8:17pm UTC](https://forum.servoy.com/t/data-field-name-from-data-changed-event/16370/3 "2012-08-20T20:17:11Z")

</div>

Hi! Thanks a lot! Really appreciate!
