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
sdavidow9sdavidow9 

Using ActionSupport on a picklist to rerender and call a controller function - not working

Hi, I have a couple of issues, but will start with the 2 basic ones and try to be brief:

Setup:  My page will display an Account name and then populate a picklist with all child accounts.

When the user selects a child account (from the picklist) a portion of the page should rerender with additional details about that child...there's more to it, and it's not the basic SFDC details page, but not important. 

 

First:  My picklist seems to be rerendering, but the function doesn't seem to be called.  I stuck in a simple "counter" to see if it's being called, and doesn't look like it.

 

2nd:  My debug logs don't seem to be doing anything.  I don't see either the system log window doing anything, or when I set up the debug log monitoring.  I have several system.debug("...") calls that don't show up.

 

Thanks in advance for any help.

 

I've put my vf page and controller below:

 

 Controller:

public with sharing class z_ppBOStartCtrl { private final Account distributor; private List<Account> shiptos; String[] shiptoselected = new String[]{}; List<SelectOption> options = new List<SelectOption>(); String poNumber; String[] pickupType = new String[]{}; List<SelectOption> pickupOptions = new List<SelectOption>(); public Id ShiptoID {get; set;} public Account shiptoselected1;// {get; set;} Integer count = 0; public Integer getCount() { return count; } public Account getshiptoselected1() { return shiptoselected1; } public String getPoNumber() { return poNumber; } public void setPoNumber(String s) { poNumber = s; } public Account getDistributor() { return distributor; } public PageReference save() { update distributor; return null; } public List<SelectOption> getoptions(){ return options; } public String[] getShiptoselected() { return Shiptoselected; } public void setShiptoselected(String[] shiptoselected) { this.shiptoselected = shiptoselected; } public List<SelectOption> getPickupOptions(){ return pickupOptions; } public String[] getPickupType() { return pickupType; } public void setPickupType(String[] pickupType) { this.pickupType = pickupType; } public z_ppBOStartCtrl() { try{ //don't worry about some of this logic as I'm not using it yet... //Use URL ContactId to find a usable contact for the queries for testing if(ApexPages.currentPage().getParameters().get('id')!=NULL){ Contact conAcctid=[select c.account.id,c.account.parent.id from contact c where c.id =:ApexPages.currentPage().getParameters().get('id')]; //Populate my picklist below //If the Account is a Parent if(conAcctid.account.parent.id==NULL) { distributor = [select id, name, parentid from Account where id = :conAcctid.account.id]; shiptos = [select a.id, a.name, a.pickup__c from Account a where a.parent.id = :conAcctid.account.id ]; options.add(new SelectOption('','--Select Below---')); for (Account a : shiptos) { options.add(new SelectOption(a.id,a.name)); }//end for }//end if //Otherwise, it's a child else { distributor = [select id, name, parentid from Account where id = :conAcctid.account.parent.id]; //The ship to will be the same account shiptos = [select id, name, parentid, pickup__c from Account where id = :conAcctid.account.id]; options.add(new SelectOption('000','--Select Below---')); for (Account a : shiptos) { options.add(new SelectOption(a.id,a.name)); } //end for }//end else } else { User currentUser = [Select ContactId, Contact.AccountId from User Where Id = : UserInfo.getUserId() Limit 1]; id conAcctid=currentUser.Contact.AccountId; distributor = [select id, name, parentid from Account where id = :conAcctid]; } } public pageReference xShipto() { system.debug('#### child selected...' + System.currentPageReference().getParameters().get('selected')); shiptoselected1 = [select a.id, a.name from Account a where a.id=:System.currentPageReference().getParameters().get('selected') limit 1]; //I've tried hardcoding a known id above, that didn't work either... count++; system.debug('#### child selected...' + shiptoselected1); return null; } }

Page:

<apex:page controller="z_ppBOStartCtrl" showheader="false" sidebar="false" id="OrderCreatePage"> <style> .ReadOnlyFieldClass { width:250px; border:0px; background-color:#F3F3EC; color:black; } </style> <apex:form > <apex:pageblock > <table width="600"> <apex:actionregion > <!-- <apex:pageBlocksection title="Beer Order for Distributor {!$User.FirstName}" columns="1"> --> <tr> <td><apex:outputText value="{!$Label.omsDistributor}" style="font-weight:bold;" /></td> <td><apex:outputtext value="{!distributor.name}" id="org" styleClass="ReadOnlyFieldClass"/></td> </tr> <tr> <td>Ship to:</td> <td> <apex:selectList value="{!shiptoselected}" size="1" id="selected" > <apex:selectOptions value="{!options}" /> <!-- <apex:param name="shiptoselected1" value="001T000000ArhA8"/> --> <apex:actionSupport event="onchange" action="{!xShipto}" rerender="shiptospecific" status="status"/> <apex:actionStatus id="status" startText="loading..."/> </apex:selectList> </td> </tr> <!-- </apex:pageBlocksection> --> </apex:actionregion> </table> <apex:outputpanel id="shiptospecific"> <apex:pageBlocksection id="xshiptospecific" rendered="true"><!-- rendered="NOT({!shiptoselected}='0')" --> xxx{!count}xxxxxx PO Number: <apex:inputtext id="poNumber" value="{!poNumber}"/> <apex:inputtext id="shiptoidnumber" value="{!shiptoselected1.id}" /> <!-- <apex:inputtext id="poNumberx" value="{!shiptoselected}"/> --> Delivery Type: <apex:selectList value="{!pickupType}" id="idx" size="1" ><!-- rendered="{!shiptos.pickup__c}" --> <apex:selectOptions value="{!pickupOptions}"/> </apex:selectList> </apex:pageBlocksection> </apex:outputpanel> </apex:pageBlock> </apex:form> </apex:page>