Dynamic checkboxes

I have a form with a group of checkboxes. But the list of checkboxes needs to be dynamic, as it changes based on what object the user is viewing.

I was thinking of adding and removing the checkbox groups from the “form” view’s elements, but seems this doesn’t get exposed?

What’s the best way to do this?

You can reload form content as

dhx.ui([
{view:‘checkbox’, …},

], $$(‘myformid’));

Such command will replace content of the form with new inputs.

If you have not so may types of objects - you can create mutliple form objects and just switch visible one through multiview.

Ok this was successful. However when i load the form elements dynamically i can’t get the values. Specifically, the following fails:

log “formVals”, $$(“filterForm”).getValues()

I just get an empty js object. When i set the elements statically in the from definition i get the values just fine. How to fix?

I have been using this formart

dhx.ui([
{view:‘checkbox’, …},

], $$(‘myformid’));

It should work. Good luck

be sure that controls in configuration have name or id attributes, it will be used for value mapping.

If issue still occurs for you - please provide any kind of sample or demo link where it can be reconstructed.