+ Start a Discussion
SuzanyuSuzanyu 

Urgent!!!!! If there is a way, please help!

Hi Experts,

 

I got a requirement to dynamically create a visualforce page. Details are below

 

Scenario

 

-On one page, there is a list showing all fields Label and Api Name of Sobject. (this part done via describe call)

-User selected some  fields from the list such as Name, Account, Email, Phone...

-The second page will be constructed by selected fields. The difficulty is in this page if a field type is picklist, the picklist will be built up onto the page as well. If the type of field is long textarea, the text input area will show up next to the field name on the page. ETC

-All stuff will be dynamically generated from selected names and their types.

 

Any idea will be great. Many thanks

 

Sue

gv007gv007
we are in same boat if u found any good solution post help lot of developers
dchasmandchasman

Sue,

 

This is a common but relatively infrequent request (I have answered essentially the same quesion at least 3 times on this forum but I'll be the first one to say that the forum searching and classification functionality is pretty poor at best). The feature being developed that would make this a snap and allow you to solve this in the most direct fashion will not be available for a number of releases.

 

With that said you can still solve this one with what is already publically available - need a bit more detail to point you in the best direction.

 

When you say "On one page, there is a list showing all fields Label and Api Name of Sobject. (this part done via describe call)" you do mean that you are using the fairly new dynamic apex feature (good) and not the ajax toolkit (not good) right?

 

How dynamicis dynamic in this case? In other words are you building a tool for an admin to be able to point and click a page into existence or is this something that an end user is going to do and the set of selected fields is going to vary all the time per interaction?

 

Message Edited by dchasman on 03-14-2009 07:12 AM
michaelforcemichaelforce

I have a crazy idea that is clearly not ideal... but you did put 5 exclamation points after "Urgent" so I figure any idea is worth voicing...

 

It sounds like you are saying that you want the user to select some fields on page 1 and then allow them to enter data into input fields for just those selected fields on page 2 of some kind of wizard.  If so, you may be able to add an inputField for every single field on the object on page 2, and then based on the selections made in page 1, simply change the rendered property to 'false' for the fields that were not checked in the first page... thus leaving only the selected fields visible and editable.

 

It requires you to modify your VF every time you add or remove a field, but it may or may not be a decent workaround in a pinch.

SuzanyuSuzanyu

Thank you guys. You are so nice to help me out. I want to clarify some idea for my app.

 

-- yes, wizard

-- all fields coming from a sobject. Those fields are likely to be name(text), type(picklist), Startdate(date), Accountname(Lookup), Cost(currency) etc. for this object, there may be 10 fields or more totally. The number of the fields can be increased if admin adds more.

-- the first page gets fields -- actually this page is build via scontrol -- why not vf page-- the reason is there are more than one page layouts and recordtypes. for each layout the set of fields are different. I grab the fields via layout describle call actually. sigh, apex can not do that now.

-- the page 2 will show the fields selected from page1.

 

 

--that is hard to predefine some <apex:inputfield>, because I dont know which and how many fields will show up. The admin can add, delete and modify them. so. hopfully everything is dynamic

 

-- I checked some posts online. the better way to do that is s-control + javascript again. so bad. because i love vf page and apex so much and become familiar with it. Now this let me switch back to scontrol.

 

 

 

keep searching keep thinking

 

Thanks

 

sue

 

 

 

 

 

 

Message Edited by Suzanyu on 03-15-2009 03:42 AM