# determining form width before onLoad Servoy 6

**URL:** <https://forum.servoy.com/t/determining-form-width-before-onload-servoy-6/14587>\
**Category:** Classic Servoy\
**Created:** [September 5, 2011, 4:38pm UTC](https://forum.servoy.com/t/determining-form-width-before-onload-servoy-6/14587 "2011-09-05T16:38:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Parry](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@Thomas\_Parry](https://forum.servoy.com/u/Thomas_Parry)\
**Post date:** [September 5, 2011, 4:38pm UTC](https://forum.servoy.com/t/determining-form-width-before-onload-servoy-6/14587/1 "2011-09-05T16:38:01Z")

</div>

I Servoy 5.2.9 when I do this before the onLoad:

```auto
var w = forms[child_frm].controller.getFormWidth()

```

the result is 0. After the onLoad the result is the correct width.

If I do this same in Servoy 6 it [properly I assume] throws an exception indicating that controller is not yet defined.

How am I able to determine a form width programmatically in Servoy 6. Note that I do not use the SolutionModel since I imported from 5.2.9. where it was not used.

(I did not see any references in the forum/wiki on this topic).

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [September 5, 2011, 7:15pm UTC](https://forum.servoy.com/t/determining-form-width-before-onload-servoy-6/14587/2 "2011-09-05T19:15:12Z")

</div>

> Thomas Parry:  
> If I do this same in Servoy 6 it [properly I assume] throws an exception indicating that controller is not yet defined.

Hi Thomas,

I think you see an error like this: ‘TypeError: Cannot read property “controller” from undefined’  
This means that actually the variable ‘child\_frm’ doesn’t point to a correct formname at that point.

Best thing you can do is debug the method and check what’s in ‘child\_frm’.

Hope this helps
