Hello,
Is it possibe add dynamically field to a APS form using javascript events.
My need is the following:
I have a form that contains people field (validator1). Once the user fill this field we want to add dynamically another people field (validator2) in the form. Once the user fill validator2 field we want to add dynamically another people field (validator3) in the form...
Best Regards,
Makram
You can use visibility condition for the field, if validation1 if filled show the second validation2 and so on.
Yes, you can do this using javascript. The bad news: it is cumbersome.
Basically you need to manipulate the form definition from javascript. The best way to do it is by listening to the FormRendered event which passes the AngularJS scope and form. You have to create the JSON for containers and fields and pass all your generated fields into
scope.allFormFields
Then, you need to pass your containers (in case you add a new container) to
form.fields
or simply to the column of an existing container (in case you don't create a container of your own to hold the fields). Anyways make always sure, that your generated JSON is correct.
Also, this approach does not support saving the form (at least not your dynamically added fields). To do that, you will need some hack to accieve this, like saving all properties into a hidden text field that holds all your values or manually use task variables which are also not that easy to do...
Good luck!
Manuel
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.