I'm writting a plugin and in that plugin I need a form that lets user choose parameters, and then generates a graph depending on those parameters.
I had a simple form (choose one activity) and a double form (choose two activities).
I'm trying now to merge these two forms into one form only.
I used the repeat_elements(); function, to repeat as many times wanted the group of elements.
But get some problems :
- The first group of elements I declare before repeating is showed. So I have "id_activitygroup_activity" and then only I have my repeated elements : "id_activitygroup_0_activity", "id_activitygroup_1_activity", etc.
Could it be possible to not show first element declared ?
- The repeating element group has a setting to set the max ammount of repetitions but I can click as many times on "add field" button, and I get new fields in form.
- I used without any problem "disableIF" before, to manually disable all fields i wanted if one select was not choosed. (eg. If you don't want to calculate average, all boxes to set average are disabled). I'm trying now to disable them even if we add new (disable all instances) but can't manage to do that.
Has anyone an idea about where to start ?
My code is here : https://pastebin.com/P2pbbwDc (full code in attachment).
Thank you very much !!