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
nasir jawednasir jawed 

problem with multiselect picklist with pageblock table and apex controller

Hi All,

 

i have an account object here where i had created a link and when i click the link a VF page comes up.This VF page contain only three fields called Business line,industry cluster and product category.

 

Here the product category depends upon industry cluster and induster cluster depends upon Business line.Since salesforce does not provide dependency on Multiselect pick list.

 

Here the problem what i am facing is like i want to create a table where these three multiselect fields should display and when i selct values from "business line" and put it on the selected values , then Industry cluster should show its values depending upon business line values selected.

 

How  can i write a method for dependency and i want to create a save action.

 

In save action when i click save the three multi select vaule should save on acount  "text" field which is a read only.I know i can convert the multiselct picklist to text field by using "valueOf".

 

 

Please help  me doing this .Let me know how i can create a table with those three field and to save this record in account page in text field.My code is below:

 

<apex:page standardController="Account" Extensions="Multiselect" showHeader="true">
  <apex:form >
    <apex:pageBlock >
         <apex:pageBlockTable value="{!account}" var="a">
         <apex:outputText value="Business Line"  />
         <apex:inputField value="{!a.Business_Line__c}" style="width:300px;" />
         
         
         
         <apex:outputText value="Industry Cluster"/>
         <apex:inputField value="{!a.Industry_Cluster__c}" style="width:300px;"/>
        
         
           
         <apex:outputText value="Product Category"/>
         <apex:inputField value="{!a.Product_Category__c}" style="width:300px;"/>
       
         </apex:pageBlockTable>
          <center><apex:commandButton value="Save" action="{!Save}"/></center>
         </apex:pageBlock>
  </apex:form>  
</apex:page>

 

public class Multiselect {
   public Id aid; 
   Public Account acc;
   Private ApexPages.StandardController c;

    public Multiselect(ApexPages.StandardController controller) {
    acc =(Account)controller.getRecord();
     System.debug('nasir:'+ acc );
     c=controller;
  
    aid = c.getRecord().id;
        }
    Public Account getAccount(){
    return acc;
    }
}

 

Bramha1Bramha1

I haven't tried, but try using some sort of javascript and ajax calls. Something like a onchange event and a ajax call to get the selected values for the value u selected.

 

 

Cheers

Bramha