# Simple Request Focus Issue

**URL:** <https://forum.servoy.com/t/simple-request-focus-issue/3719>\
**Category:** Classic Servoy\
**Created:** [February 22, 2005, 8:08pm UTC](https://forum.servoy.com/t/simple-request-focus-issue/3719 "2005-02-22T20:08:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebrandt](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@ebrandt](https://forum.servoy.com/u/ebrandt)\
**Post date:** [February 22, 2005, 8:08pm UTC](https://forum.servoy.com/t/simple-request-focus-issue/3719/1 "2005-02-22T20:08:17Z")

</div>

I have a tab panel with several tabs. I want to validate a field located on one of the tabs.

If the validation fails, I want to request focus on the tab form / and field. I tried manually coding it, but it was not an available element in the method editor tree, so I figured it would not work.

if (return\_shipping\_acct\_id == null)  
{  
plugins.dialogs.showErrorDialog(‘Validation Error’, ‘Please enter a valid Return Shipping Account.’,‘OK’);  
elements.tabs\_70. **Return\_Shipping\_Acct\_Number**.requestFocus();  
return  
}

I also played around with the tab element options (get / Set) but cannot figure out how to get a specific tab form to open

I am guessing its a simple index command.

thanks for any help!

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [February 22, 2005, 8:48pm UTC](https://forum.servoy.com/t/simple-request-focus-issue/3719/2 "2005-02-22T20:48:09Z")

</div>

Out of my head: I think you should try to access the field you want the focus for by the form. So instead of

```auto
elements.tabs_70.Return_Shipping_Acct_Number.requestFocus();

```

something like

```auto
forms.Return_Shipping_Acct_Number.elements.your_field.requestFocus();

```

and make sure the tab index is on the tab where the user sees the field.

---

<div class="post-metadata">

**Author:** ![ebrandt](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@ebrandt](https://forum.servoy.com/u/ebrandt)\
**Post date:** [February 22, 2005, 9:07pm UTC](https://forum.servoy.com/t/simple-request-focus-issue/3719/3 "2005-02-22T21:07:43Z")

</div>

Well, that was a great Idea, I accessed the element and the form directly. the focus went to the field, but the tab in which the field is located, still does not come to focus (open) (I have 5 other tabs in theis tab panel)

if (return\_shipping\_acct\_id == null)  
{  
plugins.dialogs.showErrorDialog(‘Validation Error’, ‘Please enter a valid Return Shipping Account.’,‘OK’);  
forms.TPEPurchaseEvalReturnShippingInfo.elements.Return\_Shipping\_Acct\_Number.requestFocus();  
return  
}

TPEPurchaseEvalReturnShippingInfo \<~~ this is the actual form, that is under one of my tabs in the main form I am validating.

Return\_Shipping\_Acct\_Number \<~~ that is the Field I am trying to request focus to.

I just need to get the **tab** that the field is located in to gain focus.

In the main form the tab panel is called tabs\_70. I can name the tab Itself, but only the tab panel shows up on the element tree.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [February 22, 2005, 9:17pm UTC](https://forum.servoy.com/t/simple-request-focus-issue/3719/4 "2005-02-22T21:17:33Z")

</div>

maybe I don’t understand your problem, but that’s what I meant with

> and make sure the tab index is on the tab where the user sees the field.

Can’t you use that elements.tabs\_70.tabIndex(3) (don’t know exactly, Servoy closed) to jump to the third tab?

---

<div class="post-metadata">

**Author:** ![ebrandt](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@ebrandt](https://forum.servoy.com/u/ebrandt)\
**Post date:** [February 23, 2005, 1:27pm UTC](https://forum.servoy.com/t/simple-request-focus-issue/3719/5 "2005-02-23T13:27:24Z")

</div>

Sorry, I did not finish reading your original post, thats what I was looking for, I figured it was a index issue. Thanks for the help

---

<div class="post-metadata">

**Author:** ![ebrandt](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@ebrandt](https://forum.servoy.com/u/ebrandt)\
**Post date:** [February 23, 2005, 3:26pm UTC](https://forum.servoy.com/t/simple-request-focus-issue/3719/6 "2005-02-23T15:26:28Z")

</div>

elements.tabs\_70.tabIndex = 4

thanks again
