# Form onDataChange called twice

**URL:** <https://forum.servoy.com/t/form-ondatachange-called-twice/20559>\
**Category:** Questions\
**Created:** [August 10, 2021, 1:04am UTC](https://forum.servoy.com/t/form-ondatachange-called-twice/20559 "2021-08-10T01:04:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![roddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@roddy](https://forum.servoy.com/u/roddy)\
**Post date:** [August 10, 2021, 1:04am UTC](https://forum.servoy.com/t/form-ondatachange-called-twice/20559/1 "2021-08-10T01:04:07Z")

</div>

When a form has a onDataChange() action; if the data source field is changed in this function, then it calls the onDataChange() again. I have tried looking at the JSEvent, old and new values but I cannot figure out a way to determine if the call is from the form itself; it could also lead to an infinite loop. The data source is a form variable.

When the second automatic call is made, the datasource still has the original newValue from the first call.

It really shouldn’t be triggering a form action event from the form again. Is there anyway of stopping the second onDataChange() call (or establishing that it is a second call)?

Thanks,
