Multitext issues


I want to limit the number of input fields a user can enter, but I'm having issues with removeSection

I would also like to add dynamic labels to subConfig, but I'm also having issues with order when input fields are added and removed.

Here is the snippet:



  • The events-based customization in such case is not handy enough, as the inner API calls onSectionAdd after the input is added and counted.
    Also, the result of onSectionAdd will be processed further, so the instant attempt to remove the input will cause an error. To avoid it in your implementation, it will be enough to delay the removing:

    if (count >= 4){
        webix.delay( webix.bind(function(){this.removeSection(i)}, this) )

    However, I would suggest you to implement the required features as a custom multitect-based control with its own addSection.
    As this function uses private methods, you need to call the prototype function if an input should be added.
    But also, you can modify the subConfig and prevent further logic if needed.
    Note that addSection has to return a view/id of a view to which the focus can be set (according to the requirement of private API).
    Please, check the following example:

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion