How to disable form behavior of toolbar?

I have a toolbar inside of a form.
When I try getFormView() from an element within toolbar, I receive toolbar’s instance instead of main form’s. And when I use main form’s instance, I can not reach elements within toolbar.

http://webix.com/snippet/bc96237b

In the test function you refer the form as ‘this’, however, javascript functions have lexical scope, so when you call test from the toolbar, ‘this’ is the current test lexical scope. If you do it like this, http://webix.com/snippet/efebbd4b, it works.

No, it does not work. I still can not get values of elements within toolbar. BTW, I don’t think that I misused “this” keyword :slight_smile:

I’m sorry, but doesn’t the snippet I provided return the correct form values as expected? When I run it, it does.

I think getFormView only works for buttons as direct elements in the form: http://webix.com/snippet/df9f8793.

P.s. I personally never use ‘this’ or ‘new’ when using javascript, too complicated for me;-).

ui.toolbar has mostly the same features as the ui.form.

But it wasn’t intended as a form component (as well as the tree, datatable).

There are two ways:

  • Quick: get two values objects and unify them;

  • Proper: create a toolbar-based component with the getValue() and setValue() methods. As follows:
    http://webix.com/snippet/6d7145ff

@halcwb in my original snippet http://webix.com/snippet/bc96237b toolbar is placed into the form and, when I call getValues() on the form, I should have received values of all elements (including placed into toolbar). but now I can get all values EXCEPT those placed into toolbar.

@Listopad both solutions do not suite me. first one since form is created dynamically. second one as it is creating independent named component.
what if I inherit toolbar and remove some form related properties?

what if I … remove some form related properties

Without “form” features the toolbar is just a layout. Something like this:

http://webix.com/snippet/2214b799

yes, as I see, form is derived from toolbar, not vise versa. very unusual method, though.

then my next question is - what should I apply so that setting labelPosition=top on the form does not break layout on the ‘toolbar’?
http://webix.com/snippet/c9a8f4e1
P.S.: I think that I should apply labelPosition:left on each element on the ‘toolbar’. Is there any other generic method?

well, I have realized that there is an undocumented option elementsConfig on layout view, where labelPosition and other common elements’ properties can be defined.

elementsConfig works for any layout cell within the form or the toolbar. Basically, it doesn’t work for the layout:

http://webix.com/snippet/e95f70fa