You need to sign in to do that
Don't have an account?
Ghanashyam
Picklist returns blank value during AJAX call
Hi,
I have a picklist field with some values in a visualforce page. I want to make an AJAX request to the detail section(below) as and when a picklist value is selected.
<apex:outputpanel>
<apex:actionsupport event="onclick" rerender="resultPanel">
<apex:param name="enqtype" value="{!case.Enquiry_Type__c}"></apex:param>
</apex:actionsupport>
</apex:outputpanel>
<apex:param name="enqtype" value="{!case.Enquiry_Type__c}"></apex:param>
</apex:actionsupport>
</apex:outputpanel>
In the same visualforce page, when I tried to use the selected picklist value( as shown in the following code), it returns blank value.
<apex:column headerValue="Email">{!$CurrentPage.parameters.enqtype} </apex:column>
In the following code in Custom Controller class the expression ":ApexPages.CurrentPage().getParameters().get('enqtype')" doesn't resolve to the selected picklist value and returns blank value as well.
cases = [select id, CreatedDate,SuppliedEmail,Suppliedname,description,enquiry_type__c from Case
where enquiry_type__c = :ApexPages.CurrentPage().getParameters().get('enqtype')];
where enquiry_type__c = :ApexPages.CurrentPage().getParameters().get('enqtype')];
Can someone enlighten me on why I get blank values. Thank you
Ghanashyam
if Enquiry_Type__c is your custom picklist field
then you must have an inputField somewhere, i did not see that in your code sample, but if you do then the user selection would be stored in case.Enquiry_Type__c
not
{!$CurrentPage.parameters.enqtype}
or
ApexPages.CurrentPage().getParameters().get('enqtype')
really need more code to understand why you are getting blanks
Hi Ron,
Thanks for the reply. Please see below the complete code.
This is what I am trying to achieve: Whenever a new queue is chosen in 'Selected queue' picklist, the data table alone should get refreshed and only those records that match the selected queue should be displayed.
The current behaviour is that the records get refreshed as and when a new queue is selected but they are not getting filtered based on the selected queue. I am not sure if I am missing anything obvious here.
+++++++++++++++ Visual Page code: Begin ++++++++++++++++++++++++++
<apex:page standardcontroller="case" extensions="dataTableCon" id="thePage">
<apex:Form >
<apex:pageBlock title="Enquiry Management">
<apex:outputpanel >
<h1>Selected queue:</h1>
<apex:inputField id="enqtypeid" value="{!case.Enquiry_Type__c}"></apex:inputField>
<apex:actionsupport event="onclick" rerender="resultPanel">
<apex:param name="enqtype" value="{!case.Enquiry_Type__c}"></apex:param>
</apex:actionsupport>
</apex:outputpanel>
<br>
</apex:pageBlock>
<apex:pageBlock title="Enquiry Queue">
<apex:outputPanel id="resultPanel" layout="block">
<apex:pageBlockTable value="{!cases}" var="cas" columnswidth="10%,10%,20%,20%,40%">
<apex:column headerValue="Due date">{!Now()} </apex:column>
<apex:column headerValue="Type">{!case.Enquiry_Type__c} </apex:column>
<apex:column headerValue="Company">{!cas.SuppliedName} </apex:column>
<apex:column headerValue="Enquiry">
<apex:outputLink value="https://na1.salesforce.com/{!cas.id}">{!cas.description} </apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:Form>
</apex:page>
+++++++++++++++ Visual Page code: End ++++++++++++++++++++++++++
The following is the code of class dataTableCon
public class dataTableCon {
public dataTableCon(ApexPages.StandardController controller) {
}
List<Case> cases;
public List<Case> getCases(){
if(cases== null)
{
cases = [select id, CreatedDate,SuppliedEmail,Suppliedname,description,enquiry_type__c from Case where enquiry_type__c=:ApexPages.currentPage().getParameters().get('enqtypeid')];
}
return cases;
}
}
Thanks
Ghanashyam
cases is set once, after that it is never null since it is part of the viewstate of the controller.
remove the statement
if(cases== null)
and it should change when you change the inquiry type
Thanks Ron. I did remove the null check for cases but for some reason the records do not get filtered as I change the 'enquiry type'. The records get filtered when I hard code the condition in the apex class. Something like the following...