1

I want to display different picklist values on selecting another picklist value. So i have put one on change event in the first selectlist and using action function i'm passing the selected attribute value to the controller. But my controller method which is referred in action function is not getting called atleast. Here is my code

<apex:page standardController="Account" extensions="AccountRecTypeChange_CLS">
 <apex:form >
<apex:actionFunction name="changeTier" action="{!mymet}" reRender="tierId"/>
<apex:outputPanel id="recTypeId">
  <apex:selectList value="{!strRecTypeName}" size="1" multiselect="false">
    <apex:selectOptions value="{!recTypeList}"/>
  </apex:selectList>
  </apex:outputPanel>
  <apex:outputPanel id="tierId">
  <apex:selectList value="{!strTier1}" size="1" multiselect="false" onchange="changeTier();">
    <apex:selectOptions value="{!Tier1_ClassificationList}"/>
  </apex:selectList>
  <apex:commandButton value="Save" action="{!CustomSave}"/>
  &nbsp;&nbsp;&nbsp;<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:outputPanel>
</apex:form>
</apex:page>

Controller :

public PageReference mymet() {

return null;

}

0

You can use ActionSupport tag to rerender the section. You do't need actionfunction and controller method.

<apex:selectList value="{!strTier1}" size="1" multiselect="false" onchange="changeTier();">
    <apex:selectOptions value="{!Tier1_ClassificationList}"/>
      <apex:actionSupport event="onchange" rerender="tierId"/> //onselect
  </apex:selectList>
| improve this answer | |
  • But i need to display the results retrieved from the controller method – ram135868 May 30 '17 at 13:58
  • @ram135868 in case you can call controller method from actionsupport – Tushar Sharma May 30 '17 at 13:59
  • thanks tushar. Please help me in this thing alone. I am getting the selected recordtype name from the selectlist. But by updating the record's recordtype using recordtypename , it is not getting updated. Can u pls tell me how to get recordtypeid and update the record – ram135868 May 30 '17 at 14:30
0

I think you need to add an around the section, e.g.

    <apex:page standardController="Account" extensions="AccountRecTypeChange_CLS">
 <apex:form >
<apex:actionFunction name="changeTier" action="{!mymet}" reRender="tierId"/>
<apex:actionRegion>
<apex:outputPanel id="recTypeId">
  <apex:selectList value="{!strRecTypeName}" size="1" multiselect="false">
    <apex:selectOptions value="{!recTypeList}"/>
  </apex:selectList>
  </apex:outputPanel>
  <apex:outputPanel id="tierId">
  <apex:selectList value="{!strTier1}" size="1" multiselect="false" onchange="changeTier();">
    <apex:selectOptions value="{!Tier1_ClassificationList}"/>
  </apex:selectList>
  <apex:commandButton value="Save" action="{!CustomSave}"/>
  &nbsp;&nbsp;&nbsp;<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:outputPanel>
</apex:actionRegion>
</apex:form>
</apex:page>
| improve this answer | |
  • Nope that didnt work – ram135868 May 30 '17 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.