Dynamic Form design in Mendix

0
Hi ,   We have a requirement where an user will enter the name of the field and decide a control like (TEXT, DATE,Currency, Checkbox etc) . This will persisted in the database. When the user goes to a specific page this data will be used to build a page dynamically. So what it means for the below example Name (TEXT) Age (number) DOB (date) it should render a page with Name as TEXTbox,  Age as Number, DoB as date time picker.  Also this may get changed as the user wants it.  So i want to know if there is a widget available before i start developing my own widget. 
asked
5 answers
0

Hi,

As I understand from your description, you need to create a dynamic way of compose a list of different attribute types.

This can be achieved  by creating a domain model, where you have a entity which groups a list. While this list can be of different types.

I would make this domain model; A entity Page which groups a list of elements. An element can be of different specializations. in this case, representing different attribute types.

 

Secondly you need a Page which shows a single object of Page with a list over association of elements. When using a Listview, you will be able to create different templates for the different specializations. This allows you to show the different specializations in a single list.

And as last create buttons for the different specializations.

That would result in the following UI

Good luck

answered
0

Hi Anirban,

Page used is a page containing dataview with context set to entity Element, so that it can serve all specializations.

On your request, added an attribute Caption to the entity Element. When you for example create a new string field, a page pops up, where you can configure the caption. 

This caption is used in the page to set the caption before the input field.

 

Domain model

Listview with caption properties

 

NewEdit page attached to create button and option to edit the caption

 

How it would look like, take some time to set the right spacing, text classes etc -> http://atlas.mendix.com 

 

 

answered
0

Hi Rene,

The caption idea worked.

But sorry i could not follow few of the things  coz am still learning Mendix.

i did exactly the way you told. But i am not able to understand 

what the String , Date, number button point to ,would it be a page for newEdit for all those.

i used new edit and saved. But the list is not showing those captions and fields like yours.

any ideas where am going wrong. Domain model is correct .

answered
0

Guess, you just selected the entity String/Date/Number. Since the list shows all element objects associated to the page object, they won't appear.

Ensure that the entity selected on the create is over the path Page_Element: Example.Element_Page/Example.String. Per specialization, pick the right one.

answered
0

Hi Rene,

I followed exactly the same steps:

 

1) Putting a dataview for the page

2) List view for the elements.

When I associate the page to navigation item then I am getting error "The selected page expects an object type of Page which is not available.

Any idea what is going on?

 

answered