What I am doing ?
I have 3 fields in an object Account(lookup to Account),User(Lookup to User) and Permissions(Multi select picklist). I needed to only show few values from all the values in permissions according to the logged-in user, thus I choose to use selectList and show only selected values.
Where is the code ?
<apex:form >
<apex:pageBlock title="User Permission Assignment" >
<apex:pageblockButtons >
<apex:commandButton action="{!Save}" value="Save" />
<apex:commandButton action="{!SaveAndNew}" value="Save and New" />
<apex:commandButton action="{!Cancel}" value="Cancel"/>
</apex:pageblockButtons>
<apex:pageBlockSection title="Information" columns="1" collapsible="false">
<apex:pageBlockSectionItem > Account <apex:inputField value="{!userPermissionAssignmentRecord.Account__c}" /></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem > User <apex:inputField value="{!userPermissionAssignmentRecord.User__c}" /></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem > Permission Sets
<apex:panelGrid columns="3" id="panelGridId">
<apex:selectList id="sel1" value="{!selectedValue}" multiselect="true" style="width:223px" size="4">
<apex:selectOptions value="{!ToSelectValues}" id="firstOptions" />
</apex:selectList>
<apex:panelGroup >
<br/>
<apex:image url="{!$Resource.SelectLogo}" height="20px" style="cursor:pointer;">
<apex:actionSupport event="onclick" action="{!selectClickButton}" reRender="panelGridId"/>
</apex:image>
<br/><br/>
<apex:image url="{!$Resource.DeselectLogo}" height="20px">
<apex:actionSupport event="onclick" action="{!deselectClickButton}" reRender="panelGridId"/>
</apex:image>
</apex:panelGroup>
<apex:selectList id="sel2" value="{!rightselected}" multiselect="true" style="width:223px" size="4">
<apex:selectOptions value="{!SelectedValues}" />
</apex:selectList>
</apex:panelGrid>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
What is the issue ?
> <apex:actionSupport event="onclick" action="{!selectClickButton}" reRender="panelGridId"/>
ActionSupport do not call the method/action selectClickButton if below input fields are included in the same form but works well if above two fields are removed.
<apex:pageBlockSectionItem > Account <apex:inputField value="{!userPermissionAssignmentRecord.Account__c}" /></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem > User <apex:inputField value="{!userPermissionAssignmentRecord.User__c}" /></apex:pageBlockSectionItem>
Trouble ?
What is it that is causing this ? How do I fix this ?