You need to sign in to do that
Don't have an account?
pjcoco
One apex:selectList controls content of another selectList
Hello developers,
I'm at the end of trying, and was wondering if it is possible to have one apex:selectList control the content of another one, i've been trying to make a visualforce page where the user gets to select from a list of email templates where the list is variable based on which Folder was selected. I've tried alot of different ways, however I don't seem to be finding a solution. Could any of you point me in the right direction, or tell me what i'm doing wrong.
My VF Code:
<apex:pageBlockSectionItem > <apex:outputLabel value="Folder" for="folders"/> <apex:selectList value="{!folderId}" size="1" id="folders" required="true"> <apex:selectOptions value="{!folders}"/> <apex:actionSupport immediate="true" event="onchange" rerender="level2" /> </apex:selectList> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="Template" for="templates"/> <apex:selectList value="{!templateId}" size="1" id="level2" required="true"> <apex:selectOptions value="{!templates}"/> </apex:selectList> </apex:pageBlockSectionItem>
my apex code:
public List<SelectOption> getFolders() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption(UserInfo.getOrganizationId(), 'Unfiled Public Email Template')); options.add(new SelectOption(UserInfo.getUserId(), 'Personal Email Template')); for(Folder f : folders) { options.add(new SelectOption(f.Id, f.Name)); } return options; } public List<SelectOption> getTemplates() { List<SelectOption> options = new List<SelectOption>(); for(EmailTemplate e : allTemplates) { if(e.FolderId == folderId) { options.add(new SelectOption(e.Id, e.Name)); } } return options; }
hmmm, somehow it got fixed. Didn't know what I did, thanks anyway