0

I am facing an issue where a select list value default selected getting passed fine to controller during compile and page load. But on change simply it's even not coming on debug statement.

Apexpage

<div class="panel panel-primary">
  <div class="panel-heading">
    <h3 class="panel-title">Campaign</h3>
  </div>
  <div class="panel-body">
    <center>
      <apex:actionRegion>
        <apex:selectList value="{!selCampaign}" size="1">
          <apex:selectOptions value="{!campaigns}" />
          <apex:actionSupport action="{!updProductList}" event="onchange" status="actStatusId"  reRender="pivot, hierPb, pb"/>
        </apex:selectList>
      </apex:actionRegion>
    </center>
  </div>                        
</div>      

Apex code in constructor itself

Set<String> SplitList = New Set<String>();
system.debug('selCampaignName@1'+selCampaignName); // Not coming after selcampaign - value change on page
system.debug('selCampaign@1'+selCampaign); // Not coming after selcampaign - value change on page
for(Sample_Order_Campaign_abv__c so : [SELECT Franchises_abv__c FROM Sample_Order_Campaign_abv__c WHERE Name =:campaignMap.get(selcampaign)]) {
  system.debug('so@@@@'+so);
  IF(!string.isBlank(so.Franchises_abv__c)) SplitList.addAll(so.Franchises_abv__c.split(';;'));
}
2

An Apex controller constructor only runs when the page is first opened. When an apex:actionSupport or apex:commandButton runs the controller, the controller instance is re-created from the view state embedded in the page i.e. the field values of the instance are restored by copying the data rather than running code such as the constructor.

Add your debug statements to the updProductList method to that is run immediately after the controller instance has been re-created to check the selCampaign value.

0

Try do something like this:

<apex:page showHeader="false" sidebar="false" controller="bookList">
    <apex:form id="frmId">
        <br>
        <center>
            <apex:selectList value="{!selectedValue}" multiselect="false" size="1">
                <apex:selectOptions value="{!aList}" />
                <apex:actionSupport action="{!bookList}" event="onchange" reRender="frmId"/>
            </apex:selectList> 
            <apex:outputText value="{!myStr}" />
        </center>
        </br>
    </apex:form>
</apex:page>
1
  • what's the outputtext here? – Testing_SFDC Dec 9 '16 at 8:07

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.