• raghu0446
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

I need to rerender based on the multiselct picklist values. It is working fine if only one value is selected, but if more than one value is selected in the multi-picklist field, only the first value is being getting the response. Please Help.

 

*****************Visualforce page part ************************ 

<apex:pageBlockSection columns="1" >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Programs user needs access to" for="apps" />
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputField value="{!Case.Citrix_Applications__c}" onselect="populateRoles()" onChange="populateRoles()" id="apps" onkeypress="return disableEnterKey(event)"/>
<apex:actionFunction immediate="true" name="populateRoles" action="{!getAppRoles}" rerender="Rolesr" status="reqstatus" focus="name"/>
<script> var rname = document.getElementById("{!$Component.apps}"); </script>
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:actionRegion >
<apex:pageBlockSection columns="1" id="Rolesr" >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Security Role" for="RolesA" />
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputField value="{!Case.Role__c}" id="RolesA" />
<script> var rem = document.getElementById("{!$Component.RolesA}"); </script>
<apex:actionStatus id="reqstatus" startText="fetching the relevant info.." />
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageblocksection>
</apex:actionRegion>

 

 

********************** Controller method **********************************

public void getAppRoles() {
String autoroles='';
// String id=ApexPages.currentPage().getParameters().get('j_id0:_form:j_id32:j_id45:j_id58:j_id59:ISTEmail');
String[] id=ApexPages.currentPage().getParameters().get('pg:_form:j_id31:j_id57:j_id64:j_id65:apps').split(';');
System.debug('======32323200000000000000===>'+id);
for (String i : id){
System.debug('======iiiiiiiiiiiiiiii===>'+id);
if(i == 'ADAPT') {
autoroles= autoroles +' PRS Update, ADAPT Update';
}if(i == 'ARTS1') {
autoroles= autoroles +' PRS Update';
}if(i == 'ARTS2') {
autoroles= autoroles +' PRS Update';
}if(i == 'MPS') {
autoroles= autoroles + ' MPS Update';
}if(i == 'PRS') {
autoroles= autoroles + ' PRS Update';
}
}
req.Role__c = autoroles;

}

 

 

 

 

Notes: Here "Citrix_Applications__c" is a multiselect Picklist field and "Role__c" is a text field which needs to auto-populate the text based on the Citrix_Applications__c values.

 

 

Thank You

I need to rerender based on the multiselct picklist values. It is working fine if only one value is selected, but if more than one value is selected in the multi-picklist field, only the first value is being getting the response. Please Help.

 

*****************Visualforce page part ************************ 

<apex:pageBlockSection columns="1" >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Programs user needs access to" for="apps" />
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputField value="{!Case.Citrix_Applications__c}" onselect="populateRoles()" onChange="populateRoles()" id="apps" onkeypress="return disableEnterKey(event)"/>
<apex:actionFunction immediate="true" name="populateRoles" action="{!getAppRoles}" rerender="Rolesr" status="reqstatus" focus="name"/>
<script> var rname = document.getElementById("{!$Component.apps}"); </script>
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:actionRegion >
<apex:pageBlockSection columns="1" id="Rolesr" >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Security Role" for="RolesA" />
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputField value="{!Case.Role__c}" id="RolesA" />
<script> var rem = document.getElementById("{!$Component.RolesA}"); </script>
<apex:actionStatus id="reqstatus" startText="fetching the relevant info.." />
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageblocksection>
</apex:actionRegion>

 

 

********************** Controller method **********************************

public void getAppRoles() {
String autoroles='';
// String id=ApexPages.currentPage().getParameters().get('j_id0:_form:j_id32:j_id45:j_id58:j_id59:ISTEmail');
String[] id=ApexPages.currentPage().getParameters().get('pg:_form:j_id31:j_id57:j_id64:j_id65:apps').split(';');
System.debug('======32323200000000000000===>'+id);
for (String i : id){
System.debug('======iiiiiiiiiiiiiiii===>'+id);
if(i == 'ADAPT') {
autoroles= autoroles +' PRS Update, ADAPT Update';
}if(i == 'ARTS1') {
autoroles= autoroles +' PRS Update';
}if(i == 'ARTS2') {
autoroles= autoroles +' PRS Update';
}if(i == 'MPS') {
autoroles= autoroles + ' MPS Update';
}if(i == 'PRS') {
autoroles= autoroles + ' PRS Update';
}
}
req.Role__c = autoroles;

}

 

 

 

 

Notes: Here "Citrix_Applications__c" is a multiselect Picklist field and "Role__c" is a text field which needs to auto-populate the text based on the Citrix_Applications__c values.

 

 

Thank You