# JSEvent's form name is NULL in onElementFocusGained

**URL:** <https://forum.servoy.com/t/jsevents-form-name-is-null-in-onelementfocusgained/14996>\
**Category:** Classic Servoy\
**Created:** [November 9, 2011, 1:20am UTC](https://forum.servoy.com/t/jsevents-form-name-is-null-in-onelementfocusgained/14996 "2011-11-09T01:20:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erikd](https://avatars.discourse-cdn.com/v4/letter/e/b782af/32.png) [@erikd](https://forum.servoy.com/u/erikd)\
**Post date:** [November 9, 2011, 1:20am UTC](https://forum.servoy.com/t/jsevents-form-name-is-null-in-onelementfocusgained/14996/1 "2011-11-09T01:20:09Z")

</div>

Hi, I am retrieving NULL when I call getFormName of JSEvent in onElementFocusGained(event).

This is the scenario:

1. I have 4 forms: 1 Main form has a TabPanel with 2 forms in a Tab. All forms extends the Parent Form.  
a. Main form (Policy)  
b. Tab1 form (Product)  
c. Tab2 form (Customers)  
d. Parent form has the onElementFocusGained(event) method.
2. I have 2 Button elements which does the following:  
a. Button1 adds a record in Tab1, calls elements[elementName].requestFocus(); to request focus, and switches the TabPanel’s index to Tab1.  
b. Button2 does the same thing with Tab2.
3. The problem occurs when I am in Tab1 and click Button2. The requestFocus() triggers onElementFocusGained(event) of the Parent form and when I check event.getFormName(), it already returns NULL.

How come the form name is NULL at this stage? This does not happen when I click the element manually through the mouse or through keyboard tab.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [November 11, 2011, 9:32am UTC](https://forum.servoy.com/t/jsevents-form-name-is-null-in-onelementfocusgained/14996/2 "2011-11-11T09:32:06Z")

</div>

make a case for this in jira with an sample attached.

---

<div class="post-metadata">

**Author:** ![Jonpaul](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@Jonpaul](https://forum.servoy.com/u/Jonpaul)\
**Post date:** [November 24, 2011, 9:54am UTC](https://forum.servoy.com/t/jsevents-form-name-is-null-in-onelementfocusgained/14996/3 "2011-11-24T09:54:21Z")

</div>

Hello  
I hava a similar problem with the onElementFocusLost method.  
Is there allredy a open case for this issue?
