Question

I came lately with an important issue and I do not know which solutions are aviable to me for solving it.

Indeed I need to creat dynamic form, let me explain it:

I have a form for an object where user can fill in mandatory fields of this object and when he save this object the other fields are fill in with default values. My issue is that i want the user to be able to chose the fields that he will fill in.

So I imagine like to put a multiselection picklist where all the object's fields are aviable and the user can chose the one that he wanna fill. Bellow I would put an 'Add' button and after my click I would like my form to be update with the new fields that my user selected. The thing is that i do not know weather I can do such dynamic form in visualforce. Did you ever had to creat this kind of stuff? If yes which tools did you use?

Thank you everyone for reading

Was it helpful?

Solution

Yes you definitely can create such form with visualforce and it shouldn't be hard. You can make a use of rendered property for a fixed number of fields or use apex:repeat tag for dynamically growing list. For example

 <apex:repeat value="{!fields}" var="f">
    <apex:inputField value="{!sObject[f]}" />
 </apex:repeat>

Where in controller fields is a List of strings containing field names.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top