Dynamic controls in K2 and update the user input to database

  • 31 December 2019
  • 1 reply

My requirement is displaying text box control dynamically based on the condition.for example case1 will display 5 text boxes case2 will display 8 text box fields like this based on each case different controls to be displayed.Also when user clicks the save button the information should store the corresponding fields in database.Please help.

1 reply

Hello  @vraj, 


There are a few different ways that you might accomplish this behavior. One option would be to create a separate view for each condition. Then you can add all of the views, that are hidden by default, to a form and then use the 'If an advanced condition is true' condition in your rules to unhide the specific view(s) that are associated with that condition. This will require you to add a form parameter that will hold the conditional data to that will be used in the logic of your rule(s). In this scenario, you could set a separate rule for each view that saves specific data to the database. The other option is similar but instead of using multiple views, you would add everything to one view as hidden and then unhide the controls that are required for each scenario. This will achieve a similar result as the first suggestion but your initialization rule and save rule will likely grow to be very large depending on how many cases you have.