You need to sign in to do that
Don't have an account?
mritz
how to use List<Date> for Input?
I want to fetch Start & End Date of each task on VF page and then perform operation on it (Save,update,delete)
But i am unable to pull data on VF page inputt fields
Apex:
VF:
I am getting this error:" Expected input type 'text', got 'date' for Id data type"
I have also tried this variation of VF code, but i dont like the extra link that appears besides the date input field
Any help would be appreciated.
But i am unable to pull data on VF page inputt fields
Apex:
public class TextClass1{ public String err{get;set;} public List<Task__c> taskList{get;set;} public List<Integer> index{get;set;} public List<date> sDate{get;set;} public List<Date> eDate{get;set;} public TestClass1{ sDate = new List<Date>(); eDate = new List<Date>(); index = new List<Integer>(); err=''; try{ taskList = [SELECT id, name,start_date__c, end_date__c FROM Task__c]; Integer i=0; for(Task__c t:taskList){ sDate.add(t.Start_Date__c); eDate.add(t.end_date__c); index.add(i++); } }catch(Exception e){ err=String.valueOf(e); } } public void saveAll(){ update taskList; } }
VF:
<apex:page id="page" showHeader="false" sidebar="false" doctype="html-5.0"> <div> <center>{!err}</center> <apex:form id="form"> <apex:repeat value="{!index}" var="i"> Task Name: <apex:inputText value="{!taskList[i].name}"/> Start Date: <apex:input type="date" value="{!sDate[i]}"/> End Date: <apex:input type="date" value="{!eDate[i]}"/><br/> </apex:repeat> <apex:commandButton value="Save All"/> </apex:form> </div> </apex:page>
I am getting this error:" Expected input type 'text', got 'date' for Id data type"
I have also tried this variation of VF code, but i dont like the extra link that appears besides the date input field
<div> <center>{!err}</center> <apex:form id="form"> <apex:repeat value="{!taskList}" var="t"> Task Name: <apex:inputText value="{!t.name}"/> Start Date: <apex:inputField type="date" value="{!t.Start_Date__c}"/> End Date: <apex:inputField type="date" value="{!t.End_Date__c}"/><br/><br/> </apex:repeat> <apex:commandButton value="Save All"/> </apex:form> </div>
Any help would be appreciated.
mritz
Correction in Vf code at line 11: <apex:commandButton action="{!saveAll}" value="Save All"/>
Deepak Gulian
Do this simply.
mritz
@Deepak, using this approach i get an additional date link which shows today's date adjacent to start date & end Date input fields. Is there any way to get rid of it?
Deepak Gulian
Update with this.