Load controls dynamically at run time in K2 smart Forms

  • 8 December 2015
  • 6 replies
  • 1 view

Badge +1

Hi,

 

Can we load controls dynamically at run time in K2 smart Forms?

 

Scenario:

Admin should be able to specify the field name and select the type of control(Text/dropdown) and save.

When he opens to the smartform,  this newly added control should be shown on the Form without involving any code changes.

 

Can this be achievable using K2 SmartForms? Please suggest me.

 

Thanks in Advance.

 

Regards,

Poornima TS


6 replies

Badge +9

Not possible out of the box..

Badge +7
You need the form design to be modified on the fly! Interesting is it possible if you can explain why is this requirement?


Cheers,
Prajwal Shambhu
Badge +2
Hello,

This is not possible oob, if u explain the requirement , it may be possible to use some workaround to achieve the same.

In case it is limited to certain number of controls hide and show control would be an option.

Thank you
Lubna
Badge +1

Still the requirements are not completely received. We are trying out the feasible ways to achieve it.

 

The requirement would be similar to rending controls dynamically using aspx page.

 

1. Admin Screen to define the control.

2. This would be saved in database.

3. While loading the smartform, depending on the controls available in the database, it needs to be created at runtime.

 

Thanks in advance.

 

Regards,

Poornima TS

Userlevel 1
Badge +8

Hi Poornima, as mentioned by previous responders to your post, this is not possible. The controls on SmartForms (and views) cannot be set dynamically at run time. Smartform definitions are stored in the K2 database and can only be altered at design time.  You can hide/show controls using rules at runtime, but you cannot "create" controls.

Badge +3

I also asked this recently. I would like to do something like having views conform to an Interface, say BlackPearlView, and the specific instantiation of a view in its form is determined at runtime using something like Dependency Injection. In this way I could create a common form, which loads a specific view.

 

 

We are looking at writing K2 solutions for ourselves and another company, the other company has very similar but distinct processes. It would be nice to have a common frame but load views with both data and actions specific to the respective business.

Reply