You need to sign in to do that
Don't have an account?
Oleg Lavvrynenko
problem with selectList and table rerendering
I have such Visualforce code
After selection some option, relate tasks should appear in table.
butt it doesn't work with such controller
<apex:page controller="MyController"> <apex:PageBlock title="My Page Block"> <apex:form > <apex:selectList value="{!Consultant}" multiselect="true"> <apex:actionSupport event="onchange" reRender="TaskBlock"/> <apex:selectOptions value="{!Consultants}"></apex:selectOptions> </apex:selectList> </apex:form> </apex:PageBlock> <apex:form > <apex:pageBlock title="Our Products" id="TaskBlock" > <apex:pageBlockSection columns="1"> <apex:pageBlockTable value="{!tasks}" var="pitem" > <apex:column headerValue="Task Name"> <apex:outputText value="{!pitem.name}"/> </apex:column> <apex:column headerValue="Consultant"> <apex:outputField value="{!pitem.Consultant__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
After selection some option, relate tasks should appear in table.
butt it doesn't work with such controller
public class MyController { public String Consultant { get; set; } public String Consultants { get; set; } public List<task__c> consultList{ get; set; } public String[] names { get; set; } public List<Task__c> pitem; public MyController() { } public void setConsultant(Id value) { pitem = [Select name,consultant__c from task__c WHERE consultant__c in (SELECT id FROM contact WHERE name= 'Kristy Doherty') ]; System.Debug('In 1'); } //public void setConsultants(){} public Set<SelectOption> getConsultants() { consultList = [Select consultant__c,consultant__r.name from task__c]; Set<SelectOption> options = new Set<SelectOption>(); System.debug(consultList.size()); for(integer i=0;i<consultList.size();i++) { if (consultList[i].consultant__r.name != null) options.add(new SelectOption(consultList[i].consultant__r.name , consultList[i].consultant__r.name )); } return options; } public List<task__c> getTasks() {return pitem;} public void setTasks(Id value) { pitem = [Select name,consultant__c from task__c WHERE consultant__c in (SELECT id FROM contact WHERE name=: value) ]; System.Debug(value); } }How can I fix it?
There are various flaws in your code: Use the below code.
Visualforce Page: Apex Class: Let me know, if you need any other help.
Thanks,
Neetu
All Answers
There are various flaws in your code: Use the below code.
Visualforce Page: Apex Class: Let me know, if you need any other help.
Thanks,
Neetu
Unknown property 'void.name'
Error is in expression '{!pitem.name}' in component <apex:outputText> in page timeentrypage
This should work. Can you provide your salesforce org login credentials so I can have a look. You can contact me either on my gmail id: neetu.bansal.5@gmail.com or Skype id: neetu.bansal.5
Thanks,
Neetu