function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mmaxtrammaxtra 

Render picklists?Please Help??

Hi:

    I have written an apex controller and VF page off a custom object. Now when an user click on New Order button it takes them to a new VF page that I created and the page tells the user how many customers are there at the top of the page already.

It would say Total Customers=3.

 

Now, I have 10 picklist and all have the same exact value in it. in Order Picklist_1__c to Picklist_10__c.

 

Since Customers=3 I need to render only 2 picklist, so on the page Picklist_1__c, Picklist_2__c should come up. One of the picklist is standard and always shows no matter what....

 

Does anyone know how to render something like this?

 

Second question is After the ORder has been saved and they go and hit Edit it takes them to the original page layout and shows them all 10 picklist fields. Do I have to create an another VF Page for the edit as well?

 

Please if there is an easier way then please let me know, or if anyone has something please let me know...

Thank You

MMA

Edwin VijayEdwin Vijay
prageethprageeth

Hello 

I don't know whether I have understood your question correctly. However you can pass the rendered property of the picklist from the controller. [Ex:-   rendered="{!firstListRendered}" ]

 

Or you can do the validation in the page side. For an example:

 

Controller: 

global class MyController{

Integer numberOfCustomers = 3;

public List<SelectOption> getJobList() {//create sample list

List<SelectOption> options = new List<SelectOption>();

options.add(new SelectOption('','-- Select an option --'));

options.add(new SelectOption('Manager','Account Manager'));

options.add(new SelectOption('Senior Manager','Senior Manager'));

return options;

}

 

public Integer getNumberOfCustomers() {

return numberOfCustomers;

}

}

 

Page: 

<apex:page Controller="MyController">

<apex:form>

<apex:selectList style="color:red" size="1" rendered = "{!numberOfCustomers > 1}">

<apex:selectOptions rendered="false" value="{!jobList}"></apex:selectOptions>

</apex:selectList>

 

<apex:selectList size="1" style="color:green" rendered = "{!numberOfCustomers > 2}">

<apex:selectOptions value="{!jobList}"></apex:selectOptions>

</apex:selectList>

 

<apex:selectList size="1" style="color:Blue" rendered = "{!numberOfCustomers > 3}">

<apex:selectOptions value="{!jobList}"></apex:selectOptions>

</apex:selectList>

</apex:form> 

</apex:page> 

 

If you are not looking for a solution like this, please supply more info and then Ill try to help you.