'.requestFocus()' on a related tabpanel

Hello,

I’m starting a methode for creating a new related record, displayed as list in a related tabpanel. The last function in the methode should be ‘.requestFocus()’ into the element on the tabpanel list, but it doesn’t work.
How can I set the cursor to a dataprovider element on a related tabpanel by methode?

Thank you for help, Thomas

Let’s change that question into ‘what do you do now?’ :)

Now I do

forms.[layout].[element].requestFocus();

but the mouse cursor is not in the dataprovider [element].

Thomas

tgs:
Now I do

forms.[layout].[element].requestFocus();

but the mouse cursor is not in the dataprovider [element].

Thomas

You should do```
forms.[formName].elements[elementName].requestFocus();

The best thing you can in these cases is to read the developer manual :)
Or use books like ‘JavaScript Pocket Reference’ etc.

Hi Marcel,

you are right! I replayed not my correct code and sent it wrong, I’m sorry. Of course the code I do in my methode is

forms.[formName].elements[elementName].requestFocus();

tgs:

forms.[formName].elements[elementName].requestFocus();

Still one period too much. :) Working code would look like this:

forms[formName].elements[elementName].requestFocus();

oops apologies for that period :oops:

Ok,

my code line is:

forms.settings_list_tab.elements.user_language.requestFocus();

The element ‘user_language’ on form ‘settings_list_tab’ belongs to the table ‘languages’. I display it in a related tabpanel on a record view form ‘settings_edit’ from table ‘settings’. On starting my methode from the form ‘settings_edit’ to create a related new record in the table ‘languages’, the mouse cursor don’t move to the dataprovider element ‘user_language’!

Thomas

I am afraid you are mixing two things.

A dataprovider is what the element refers to.

Referrral, like this, can not be done through the dataprovider name.
Instead you need to set the name of the element.

The dataprovider name is the same as the element name. I name my elements like the dataprovider, labels, buttons and so on…