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
Ravi PrabhuRavi Prabhu 

Visualforce InputText and Date value not passing to controller

Hi,

This looks simple but not able to find the issue. 

I have 2 pageblocks in a visualforce page. The 1st page block is for data entry contains date and name columns. The user will input the date and name which will insert in the object. This is working fine. 

The 2nd page block is for selecting the date and name (dropdown). Based on the selection of 2 fields display the records in the table.

The problem is when I select the date (from date picker - JS code) and name, the page does not do anything. Also by looking at debug log it shows the SOQL query is returning SQL 100 i.e. no rows for the selected values. 
The requirement in 2nd page block 
     -- display the records
     -- once displayed, the user should be able to select the records           --  delete the selected records
Please help.
//used for data entry for 1st pageblock
	public Ticket_Effort_Category__c tktRecord{set;get;}

       //date selected from 2nd pageblock
	public Date selectedDate {get;set;}
	
	//need to send the records to display in visualforce in 2nd pageblock
	public list<Ticket_Effort_Category__c> fetchList{get;set;}

	//gives list of users in drop down in 2nd page block
	public list<Ticket_Effort_Category__c> userList{get;set;}
	List<SelectOption> selectOptions{get;set;}    


	public void getsummarylist(){
        
        	fetchList = [select id, Date__c, ticket_number__c, Division__c, Application__c, Responsible__c, Effort__c 
                     from Ticket_Effort_Category__c 
                     where Responsible__c = :selecteduserId and
                     	        Date__c 	          = :selectedDate];



   <apex:actionRegion >    
    <!--Summary section -->    
	<apex:pageBlock id="pgblock2" title="Summary"   >
	        <apex:pageBlockSection id="pgblocksection2" >
        		<apex:OutputPanel >
		              <apex:panelGrid columns="5">
			             <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" >
                        			        Date </apex:outputLabel>
			             <apex:inputText  id="Date" value="{!SelectedDate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="10" disabled="false" style="width:90px; margin-right:10px;"  />

			             <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" >
                        		              Select Assigned Person </apex:outputLabel>
			
			             <apex:selectList id="selectedlist" value="{!selecteduserId}" size="1" multiselect="false" style="margin-right:10px;" >
					                <apex:selectOptions value="{!ListOfUser}" />
			             </apex:selectList>
               
			              <apex:commandButton action = "{!getsummarylist}" value="Go" immediate="true" onclick="validatechk();" rerender="msgsS" />
			        </apex:panelGrid>           
		        </apex:OutputPanel>
         </apex:pageBlockSection>

	<!--Summary-->
        <apex:pageBlockTable value="{!fetchlist}" var="I"  id="msgsS" >
            <apex:column headervalue="Date" > 
		  <apex:outputField 	value="{!I.Date__c}"/>
            </apex:column>
            <apex:column headervalue="Ticket Number">
	          <apex:outputField  	value="{!I.Ticket_Number__c}"/>
            </apex:column>
             <apex:column headervalue="Division" >
                  <apex:outputField  	value="{!I.Division__c}"/>
            </apex:column>
            <apex:column headervalue="Application" >
                  <apex:outputField  	value="{!I.Application__c}"/>
            </apex:column>
            <apex:column headervalue="Responsible" >
                 <apex:outputField  	value="{!I.Responsible__c}"/>
            </apex:column>
            <apex:column headervalue="Effort" >
                 <apex:outputField  	value="{!I.Effort__c}"/>
            </apex:column>
        </apex:pageBlockTable>
     
       </apex:pageBlock>   
        
        </apex:actionRegion>



 
Best Answer chosen by Ravi Prabhu
Ravi PrabhuRavi Prabhu
Able to recolve by adding <apex:param component

All Answers

Ravi PrabhuRavi Prabhu
I have added full code of controller and visualforce page for your reference. The drop down {!ListOfUser} has no problem, the field shows all user names (ListOfUser fetched from picklist values of 'Responsible__c' field). 
APEX controller
public with sharing class AllTicketReporting {

    public Ticket_Effort_Category__c tktRecord{set;get;}
    public list<Ticket_Effort_Category__c> fetchList{get;set;}
    public list<Ticket_Effort_Category__c> userList{get;set;}
    public String selecteduserId {get;set;}
    public Date selectedDate {get;set;}
    List<SelectOption> selectOptions{get;set;}
  
    public AllTicketReporting() {
        
  	     	 tktRecord = new Ticket_Effort_Category__c(); 
                 fetchList = new list<Ticket_Effort_Category__c>(); 
  
 	}
    
    public Pagereference saveTicketData(){
            
          	List<Ticket_Effort_Category__c> ticketExist = new List<Ticket_Effort_Category__c> ();
            ticketExist = [select id from Ticket_Effort_Category__c 
            		       where Ticket_Number__C = :tktRecord.Ticket_Number__C ] ;
        try{
               insert tktRecord;

              PageReference pr = new PageReference('/apex/TicketReporting?core.apexpages.request.devconsole=1');
              pr.setRedirect(true);
          
              return pr;
            
       }
        catch(Exception e){
            String error = e.getMessage();
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error));
            return null;
            
        }
    }


    public Pagereference cancelTicketData() {
        tktRecord = new Ticket_Effort_Category__c();
        return null;
    }
    
    public void getsummarylist(){
        	fetchList = [select id, Date__c, ticket_number__c, Division__c, Application__c, Responsible__c, Effort__c 
                     from Ticket_Effort_Category__c 
                     where Responsible__c = :selecteduserId and
                     	   Date__c = :selectedDate];
    }       
	
	
   public pageReference showRecords(){
        return null;
    }
    
    
    public List<SelectOption> getListOfUser(){
 		 
         selectOptions = new List<SelectOption>();
         selectOptions.add(new SelectOption( ' ' ,'---Select---'));
     	 Schema.DescribeFieldResult describeResult = Ticket_Effort_Category__c.Responsible__c.getDescribe();
      	List<Schema.PicklistEntry> pickListEntries = describeResult.getPicklistValues();
            
      	for( Schema.PicklistEntry eachEntry : pickListEntries) {
         selectOptions.add(new SelectOption(eachEntry.getLabel(), eachEntry.getValue()));    
      	}
        return selectOptions;
        
	}

}

Visualforce page:

<apex:page id="pageID" Controller="AllTicketReporting"   showHeader="false" tabStyle="Ticket_Effort_Category__c" >
    <script>
  		document.title = "XYZ Reporting";
	</script>
    <script>
	function DynamicDatePicker(d_id)
	{
    DatePicker.pickDate(false,d_id.id,false);
	}
	</script>
    
    <!--validate input fields in summary section-->
    <script>
    	function validatechk(){
	        var chk2 = document.getElementById("{!$Component.pageId.formId.pgblock2.pgblocksection2.selectedlist}").value;
			if(chk2 == ' '){
				alert("Please select the name")
			}
    	}
	</script>
	   
    <style type="text/css">
       .activeTab {background-color: #236FBf;  color:white; background-image:none}
       .inactiveTab { background-color: white; color:black; background-image:none}
    	body{background-color: #F8F8FF;}
       .bPageBlock {background-color: #778899 ;}
        .bAlign {text-align:center;}
    </style>
    
    <apex:panelGrid columns="2" width="100%">
        <apex:panelGrid columns="1" width="100%">
			<img src="{!$Resource.logo1}" width="100px" height="100px" align="left"/>
        </apex:panelGrid>

        <apex:outputlabel style="font-style:regular; font-weight:bold; font-size:30px; font-family:Helvetica; color:DodgerBlue;" 
                          value="AMS Reporting" />

    </apex:panelGrid>
    <apex:form id="formId" styleClass="myFormStyle" >
	
    <!-- 1st pageblock Incident reporting -->
        <apex:pageBlock title="Incident / Problem Reporting" tabStyle="Ticket_Effort_Category__c" >
        <apex:pageBlockTable value="{!tktRecord}"  title="Incident Reporting" var="Incident" id="msgsI" >
            
        	<apex:column headerValue="Date">
                	
                    <apex:inputField value="{!Incident.Date__c}" required="true"/>
            </apex:column>
            
            <apex:column headerValue="Divsion">
                    <apex:inputField value="{!Incident.Division__c}" required="true"/>
            </apex:column>
            <apex:column headerValue="Application">
                    <apex:inputField value="{!Incident.Application__c}" required="true"/>
            </apex:column>
           	<apex:column headerValue="Ticket Number">
            		<apex:inputField value="{!Incident.Ticket_Number__c}" required="true"/>
            </apex:column>
    		<apex:column headerValue="Technology">   
	        		<apex:inputField value="{!Incident.Technology__c}" required="true"/>
            </apex:column>
        	<apex:column headerValue="Responsible">
    				<apex:inputField value="{!Incident.Responsible__c}" required="true" />
        	</apex:column>
         	<apex:column headerValue="Phase">
            		<apex:inputField value="{!Incident.Phase__c}" required="true"/>
         	</apex:column>
         	<apex:column headerValue="Effort">
            		<apex:inputField value="{!Incident.Effort__c}" required="true"/>
          	</apex:column>
       	</apex:pageBlockTable>
        
        <apex:pageBlockButtons location="bottom" style="float:centre">
        	<apex:commandButton value="Save" 	action="{!saveTicketData}" reRender="msgsI" style="margin-right:20px;" />
            <!--apex:commandButton value="Save">
                 <apex:actionSupport action="{!saveTicketData}" event="onchange" rerender="msgsI" />
            </apex:commandButton-->    
            <apex:commandButton value="Cancel" 	action="{!cancelTicketData}" reRender="msgsI" style="margin-right:30px;" immediate="true"/>
            <!--apex:commandButton value="Cancel">
                 <apex:actionSupport action="{!cancelTicketData}" event="onchange" rerender="msgsI" />
            </apex:commandButton-->    
            <apex:outputLink value="https://curious-impala-lyabo0-dev-ed--c.visualforce.com/apex/ExcepReportDownload?core.apexpages.request.devconsole=1" id="theLink" style="margin-right:600px;">Export</apex:outputLink>
        </apex:pageBlockButtons>
    </apex:pageBlock>
  
 	
    <apex:actionRegion >    
    <!-- 2nd Pageblock section -->    
	<apex:pageBlock id="pgblock2" title="Show selected date and names"   >
        <apex:pageBlockSection id="pgblocksection2" >
        <apex:OutputPanel >
         <apex:panelGrid columns="5">
        	     <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" >
                                      Date </apex:outputLabel>
 	            <apex:inputText  id="Date" value="{!SelectedDate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="10" disabled="false" style="width:90px; margin-right:10px;"  />
 
	            <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" >
                                      Select Assigned Person </apex:outputLabel>
	             <apex:selectList id="selectedlist" value="{!selecteduserId}" size="1" multiselect="false" style="margin-right:10px;" >
        		        <apex:selectOptions value="{!ListOfUser}" />
	             </apex:selectList>
        
	              <apex:commandButton action = "{!getsummarylist}" value="Go" immediate="true" onclick="validatechk();" rerender="msgsS" >
        		
		      </apex:commandButton>
	</apex:panelGrid>           
        </apex:OutputPanel>
        </apex:pageBlockSection>
    
	<!--Display records-->
        <apex:pageBlockTable value="{!fetchlist}" var="I"  id="msgsS" >
            <apex:column headervalue="Date" > 
	            <apex:outputField value="{!I.Date__c}"/>
            </apex:column>
            <apex:column headervalue="Ticket Number">
            	<apex:outputField  value="{!I.Ticket_Number__c}"/>
            </apex:column>
             <apex:column headervalue="Division" >
                 <apex:outputField  value="{!I.Division__c}"/>
            </apex:column>
             <apex:column headervalue="Application" >
                 <apex:outputField  value="{!I.Application__c}"/>
                 </apex:column>
             <apex:column headervalue="Responsible" >
                 <apex:outputField  value="{!I.Responsible__c}"/>
                 </apex:column>
             <apex:column headervalue="Effort" >
                 <apex:outputField  value="{!I.Effort__c}"/>
                 </apex:column>

        </apex:pageBlockTable>
     
       </apex:pageBlock>   
        
        </apex:actionRegion>
    </apex:form>
</apex:page>

 
Ravi PrabhuRavi Prabhu
Able to recolve by adding <apex:param component
This was selected as the best answer