Formname of form within another form

In a form that contains other forms, can one programatically get the formname of the ‘active’ form (i.e. where the cursor previously was) from within a button that is located in the header part of the parent form?

to get the parentForm of a nested (tabpanel) form:

var vDataset = controller.getFormContext();
	if (vDataset.getMaxRowIndex() > 1) {
		var vParentFormName = vDataset.getValue(vDataset.getMaxRowIndex() - 1, 2 )
        }

you can get more information out of that vDataset, if you want…

Harjo,

My initial post was probably not clear enough. Apologies…

I wish to be able to navigate through records of any form (parent) and its sub-forms (children) using buttons placed in the header part of the parent form. I understand that the problem is context. As soon as I click on any button located in the header part, context returns to the parent form. I had hoped that Servoy would have a function/method that could be used to work around this.

ylockson:
I wish to be able to navigate through records of any form (parent) and its sub-forms (children) using buttons placed in the header part of the parent form. I understand that the problem is context. As soon as I click on any button located in the header part, context returns to the parent form. I had hoped that Servoy would have a function/method that could be used to work around this.

When you enter a child form (form > onElementFocusGained probably), set a form variable on the parent form with some sort of context string or object. Then set the code in your nav buttons to refer to this form variable for what to navigate.

David,

Good suggestion. However, for the navigation buttons to also work correctly for the outermost form, the same onElementFocusGained method of the inner forms must also be set for the outermost form but must not ‘react’ to any navigation button. Otherwise, context will be lost again.

Thanks. I’ll try that.

ps. I wonder whether the incessant activation onElementFocusGained event is ‘expensive’ especially in cloud computing. The best solution would be for Servoy to supply a special button type or property that does not shift context.