Advice on dynamically adding content to form #13

Closed
opened 2020-05-11 09:09:58 +00:00 by frenos · 3 comments
frenos commented 2020-05-11 09:09:58 +00:00 (Migrated from gitlab.com)

Hey,
thank you very much for all the work you have put into this lib. It is really awesome to use.

I build a tool to have users create their task 'graphically', start it and have a nice progress view of the state.
In my input form I need to dynamically add or remove elements from the form.
For example if the user selects 'element A' in a dropdown he should see checkboxes 1,2,3 and if he selects 'element B' in the dropdown he should see checkboxes 4,5,6,7.
In a future version this should even be fed from a api call.

The only way I currently see this working is have a parameter in my func to create the form and adding either checkboxes, then in the selected func of the dropdown create a new form and set the current root to the new form. Basically the form itself creates a new version of it self and overwrites itself.
This feels very convoluted and just not right, is there a better way?

Hey, thank you very much for all the work you have put into this lib. It is really awesome to use. I build a tool to have users create their task 'graphically', start it and have a nice progress view of the state. In my input form I need to dynamically add or remove elements from the form. For example if the user selects 'element A' in a dropdown he should see checkboxes 1,2,3 and if he selects 'element B' in the dropdown he should see checkboxes 4,5,6,7. In a future version this should even be fed from a api call. The only way I currently see this working is have a parameter in my func to create the form and adding either checkboxes, then in the selected func of the dropdown create a new form and set the current root to the new form. Basically the form itself creates a new version of it self and overwrites itself. This feels very convoluted and just not *right*, is there a better way?
tslocum commented 2020-05-11 16:45:17 +00:00 (Migrated from gitlab.com)

Thanks @frenos. I believe that is currently the only solution.

Would adding methods such as Form.HideFormItem(p Primitive) and Form.ShowFormItem(p Primitive) make the most sense? Or perhaps you have something else in mind?

Thanks @frenos. I believe that is currently the only solution. Would adding methods such as `Form.HideFormItem(p Primitive)` and `Form.ShowFormItem(p Primitive)` make the most sense? Or perhaps you have something else in mind?
frenos commented 2020-05-12 05:31:56 +00:00 (Migrated from gitlab.com)

Yes, I think that should work well. Thank you.

Yes, I think that should work well. Thank you.
tslocum commented 2020-10-20 04:13:57 +00:00 (Migrated from gitlab.com)

This is now available via GetFormItem().SetVisible().

This is now available via `GetFormItem().SetVisible()`.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tslocum/cview#13
No description provided.