• rahmed
  • NEWBIE
  • 0 Points
  • Member since 2009

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

I used the example on http://wiki.developerforce.com/index.php/Extended_Functionality_of_Visualforce_-_Part_2 to make a VF page that has 2 picklists. one is dependent on the other. I bascally need to render the second picklist (trader) when i make a selection on the first one (acctName). My problem is that the acctNname picklist populates, but when i make a selection the other picklist (trader) does NOT populate aoccrdingly - it stays empty.

 

<apex:page standardController="Case" extensions="CaseExtension" standardStylesheets="true"> 

<apex:sectionHeader title="Request Information" subtitle="{!case.id}"></apex:sectionHeader>

<apex:form >

<apex:pageBlock title="Request Information" mode="edit">

<apex:outputLabel value="Account Name" for="acctName"></apex:outputLabel>

<apex:selectList id="acctName" value="{!acctName}" size="1">

<apex:actionSupport event="onchange" rerender="trader"/>

<apex:selectOptions value="{!Accts}"></apex:selectOptions>

</apex:selectList> 

<apex:pageBlockSectionItem >

<apex:outputLabel value="Trader ID" for="trader"></apex:outputLabel>

<apex:selectList id="trader" value="{!trader}" size="1" title="Trader ID" >

<apex:selectOptions value="{!Tids}"></apex:selectOptions>

</apex:selectList>

  

 

</apex:pageBlock> </apex:form>

</apex:page>

 

apex class:
-----------

public class CaseExtension {

private final Case u;

public CaseExtension(ApexPages.StandardController stdController) { this.u = (Case)stdController.getRecord(); }

String acctName;

String trader;

public String getacctName() { return acctName; }

public void setacctName(String s) {  this.acctname = s; }

public String gettrader() {  return trader; }

public void settrader(String s) {  this.trader = s; }

 

public List<selectOption> getAccts() {

List<selectOption> optionList = new List<selectOption>();

optionList.add(new selectOption('', '- None -'));  

for (Account a : [SELECT name FROM Account order by Name]) {  

optionList.add(new selectOption(a.Id, a.Name));  

}

return optionList;  

}

public List<selectOption> getTids() {

List<selectOption> optionList = new List<selectOption>();   

optionList.add(new selectOption('', '- None -')); 

for (Firm_Trader_ID__c r : [SELECT name FROM Firm_Trader_ID__c r WHERE r.Account__r.Name = :acctName]) { 

optionList.add(new selectOption(r.Id, r.Name));  

}

return optionList;

}

}

------

What am i missign here? help on this matter will be appreciated.

  • April 25, 2009
  • Like
  • 0

I have a custom object 'XYZ' which has 3 fields; 1 Master Relationship to Case, 1 Master Relationship to Account, 1 is text. Also, please note that the Case and Account objects are related by default. In the Case Detail page from the 'XYZ' tab/list i have a button that is 'NEW XYZ' (by defualt). When i click on that, it takes me to a page where i can enter a new XYZ. The Case field is prefilled with the case number. however, i also want the Account field to be prefilled as well with the Account. The account was entered when i created the Case.

 

Help would be appreaicated. Thank you.

  • April 01, 2009
  • Like
  • 0