function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jeremy DeseezJeremy Deseez 

Picklist Date doesn't work

Hello SFDC Dev,

I have a pageblock table that's show Quotas of Sales.
I have a picklist (this picklist works) of user role, and the rerender work for the table.
But when I put a picklist of Date, nothing happens for the table and the value of the picklist is not send to the controller.
Some code :
<apex:outputlabel value="User Role"/>
	<apex:selectList value="{!idofuserrole}"  size="1">
	<apex:actionSupport event="onchange" action="{!searchQuotas}" reRender="allquotas"/>
	<apex:selectOptions value="{!userrole}"  />
	</apex:selectList>

		<apex:outputlabel value="Quarter"/>
	<apex:selectList value="{!namequarter}"  size="1">
	<apex:actionSupport event="onchange" action="{!searchQuotas}" reRender="allquotas"/>
	<apex:selectOptions value="{!QuarterList}" />
	</apex:selectList>
	
	<apex:pageBlockTable value="{!allthequotas}" id="table" var="key" title="{!namequarter}">
	<apex:facet name="header">
	
	<input type="checkbox" id="checkAllBox" onchange="toggleCheckAll(this)"/> Select Quarter 
	</apex:facet>
	<apex:column>
	<input type="checkbox" data-inputid="val1"/>
	</apex:column>
	<apex:column headerValue="Name">
	<apex:outputField  value="{!key.QuotaOwnerId}"/>
	</apex:column>
	<apex:column headerValue="Quota">
	<apex:inputField value="{!key.QuotaAmount}" required="false" id="val1"/>
	</apex:column>
	<apex:column headerValue="Quota">
	<apex:inputField value="{!key.StartDate}" required="false"/>
	</apex:column>
	</apex:pageBlockTable>
	
	
	public Date namequarter{get{
		if(namequarter == null){
		namequarter = Date.today();

	}return namequarter;
	}
	set;
}

	
	public List<SelectOption> getQuarterList(){
	List<SelectOption> optionsquarter = new List<SelectOption>();
	List<SObject> resultsquarter = [SELECT FullyQualifiedLabel,EndDate,StartDate,Type
	FROM Period
	WHERE Type = 'Quarter'
	AND StartDate >= TODAY];
	for(SObject rq : resultsquarter){
		optionsquarter.add(new SelectOption(String.valueOf(rq.get('StartDate')),String.valueOf(rq.get('StartDate'))));
	}
	return optionsquarter;
}
Thanks for your responses.

 
Abhilash Mishra 13Abhilash Mishra 13
Hi Jeremy Where is the  component having id  "allquotas".  specified in the rerender.  if you want to rerender pageblock table. please use id of table in rerender.
Jeremy DeseezJeremy Deseez
Sorry I haven't put it in the code example.
<apex:pageBlockSection columns="4" id="allquotas">
<apex:pageBlockTable value="{!allthequotas}" id="table" var="key" title="{!namequarter}">
.....

 
Abhilash Mishra 13Abhilash Mishra 13
Hi Jeremy,
replace this,
​public Date namequarter{
   get{ 
       if(namequarter == null){ namequarter = Date.today();
   }
   return namequarter; }
    set; }

By 
 
​public string  namequarter{
   get{
       if(namequarter == null){ 
            namequarter = string.valueof(Date.today()); 
        }
    return namequarter; } 

set; }

And use Date.valueof(namequarter), in query of the page block table.

Let me know this works or not.