You need to sign in to do that
Don't have an account?
veeru_pari
Error while displaying output
I am getting the nullpointer while displaying the controller code in vf using output panel .How can i resolve this
public class FAQCu {
public String selectedValue {get;set;}
public List<SelectOption> getUserType()
{
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult =FAQ__c.Users__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
// options.add(new SelectOption('All','All'));
for( Schema.PicklistEntry f : ple)
{
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}
public List<FAQ__c> getSearch(){
System.debug('====selectedValue===='+selectedValue); // You will get the Selected Value here
List<FAQ__c> temp = new List<FAQ__c>();
String queryString;
if(selectedValue=='AllUsers')
queryString='SELECT Users__c,Question__c,Answer__cfrom FAQ__c WHERE Users__c = \' AllUsers\' ';
else if(selectedValue=='InternalUsers')
queryString='SELECT Users__c,Question__c,Answer__cfrom FAQ__c WHERE Users__c = \' InternalUsers\' ';
else if(selectedValue=='ExternalUsers')
queryString='SELECT Users__c,Question__c,Answer__cfrom FAQ__c WHERE Users__c = \' InternalUsers\' ';
temp = Database.query(queryString);
return temp;
}
}
Vf page
<apex:page controller="FAQCu">
<apex:form >
<apex:selectList id="users" value="{!selectedValue}" size="1" required="true">
<apex:selectOptions value="{!userType}"/>
</apex:selectList>
</apex:form>
</apex:page>
In the above vf where and what tags should i write to display theoutput?Please help on this
Thanks
public class FAQCu {
public String selectedValue {get;set;}
public List<SelectOption> getUserType()
{
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult =FAQ__c.Users__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
// options.add(new SelectOption('All','All'));
for( Schema.PicklistEntry f : ple)
{
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}
public List<FAQ__c> getSearch(){
System.debug('====selectedValue===='+selectedValue); // You will get the Selected Value here
List<FAQ__c> temp = new List<FAQ__c>();
String queryString;
if(selectedValue=='AllUsers')
queryString='SELECT Users__c,Question__c,Answer__cfrom FAQ__c WHERE Users__c = \' AllUsers\' ';
else if(selectedValue=='InternalUsers')
queryString='SELECT Users__c,Question__c,Answer__cfrom FAQ__c WHERE Users__c = \' InternalUsers\' ';
else if(selectedValue=='ExternalUsers')
queryString='SELECT Users__c,Question__c,Answer__cfrom FAQ__c WHERE Users__c = \' InternalUsers\' ';
temp = Database.query(queryString);
return temp;
}
}
Vf page
<apex:page controller="FAQCu">
<apex:form >
<apex:selectList id="users" value="{!selectedValue}" size="1" required="true">
<apex:selectOptions value="{!userType}"/>
</apex:selectList>
</apex:form>
</apex:page>
In the above vf where and what tags should i write to display theoutput?Please help on this
Thanks
When are you getting the error? is it run time?
Can you tell on which line you are getting the error and the complete error message if possible.
Regards,
Ashish
See the suggesstions given in the below posts and mark the posts as Solved if the suggesstions solve the issue,
https://developer.salesforce.com/forums/ForumsMain?id=906F00000009Dc5IAE
https://developer.salesforce.com/forums/ForumsMain?id=906F00000009DgMIAU
Regards,
Ashish