• Sreejb
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies
Hi Friends,

I am new to vf page development. I have custom object Time_entry_details. Fields are Activity__c, Hour__c Date__c and lookup field to time_entry__c.

My vf Page look like this

User-added image

Here Activity is picklist and other columns are (SUN to SAT) Input text boxes.

Scanario is

I select one activity and enter hours in monday wednesday text box in any row. If i click on save button it should save in time_entry_details__c object. while retriving the record it should show in the same text boxes.

Question is

How to refer each text box to object. I am thinking in background we need to give some unique reference.... like in excel cell (A1,A2,A3...Like). How to do like that? If i am wrong please lead me.

Herewith attached my vf page and controller. Please give me solution.
 
<apex:page showHeader="false" sidebar="false" controller="timeentrydetails" >
    <apex:form >
        <apex:pageBlock title="Time Entry Details Page - {!$CurrentPage.parameters.startDate} - {!$CurrentPage.parameters.endDate} ">
            <apex:pageBlockButtons location="top" >
                <apex:CommandButton value="Save" action="{!save1}"/>
                <apex:CommandButton value="Submitted"/>
                <apex:CommandButton value="Addrows" action="{!addrows5}" reRender="row"/>
                <apex:CommandButton value="Back" action="{!back1}"/>
            </apex:pageBlockButtons>

             
            <apex:pageBlockTable id="row" value="{!Tedt_list}" var="i">
                <apex:column headerValue="Activity" >
 
                                    <apex:selectList multiselect="false" size="1" >
                                        <apex:selectOption itemValue="--Select--" itemLabel="--Select--"/>
                                        <apex:selectOption itemValue="Analysing" itemLabel="Analysing"/>
                                        <apex:selectOption itemValue="Designing" itemLabel="Designing"/>
                                        <apex:selectOption itemValue="Code Developing" itemLabel="Developing"/>
                                        <apex:selectOption itemValue="Testing" itemLabel="Testing"/>
                                    </apex:selectList>
                               </apex:column>             

                       <apex:column headerValue="SUN">
                       <apex:inputText size="10" />
                       </apex:column>
                       
                       <apex:column headerValue="MON">
                       <apex:inputText size="10" />
                       </apex:column>
                       
                       <apex:column headerValue="TUE">
                       <apex:inputText size="10" />
                       </apex:column>
                       
                       <apex:column headerValue="WED">
                       <apex:inputText size="10" />
                       </apex:column>

                       <apex:column headerValue="THU">
                       <apex:inputText size="10" />
                       </apex:column>
                       
                       <apex:column headerValue="FRI">
                       <apex:inputText size="10" />
                       </apex:column>
                       
                       <apex:column headerValue="SAT">
                       <apex:inputText size="10" />
                       </apex:column>
                      
                
            </apex:pageBlockTable>
        
        </apex:pageBlock>
    
    
    </apex:form>
      
 
</apex:page>

Controller is
 
public class timeentrydetails {


    Public Class Tedrow{
        Public Id Tedid {get;set;}
        Public Id Teid {get;set;}
        Public Date Date1{get;set;}
        Public String Activity {get;set;}
        Public Integer Hour {get;set;}
        Public String Uniid {get;set;}
        Public String Day {get;set;}
    
    }
    
  
     public List<Time_Entry_Detail__c> Tedt_list {get;set;} 
     public List<Tedrow> Tedrow_list {get;set;} 
     
    Public timeentrydetails(){
    
        string teid = apexpages.currentpage().getparameters().get('id').trim();
        system.debug(teid);
        string tesdate = apexpages.currentpage().getparameters().get('startDate');
        system.debug(tesdate);
        string teedate = apexpages.currentpage().getparameters().get('endDate');
        system.debug(teedate);
        Tedt_list = new List<Time_Entry_Detail__c>();
        Tedrow_list  = new List<Tedrow>();
        Tedrow Tedrow_item = new Tedrow();
        
        if(teid!=null && teid!= '')
        {
            id timedetailid = (id) teid;
            Tedt_list = [select id, name,Time_Entry__c,Activity__c,Date__c,Hour__c,Date_Day_value__c FROM Time_Entry_Detail__c where Time_Entry__c =:timedetailid and ownerid =:userinfo.getuserid() limit 150];
        }

        for(integer i=Tedt_list.size();i<5;i++)
        {
             Time_Entry_Detail__c tedt = new Time_Entry_Detail__c();
             Tedt_list.add(tedt); 
        }      
  
        for(Time_Entry_Detail__c ted_item  :Tedt_list )
        {
               Tedrow_item.Activity  = ted_item.Activity__c;
               Tedrow_item.Date1=ted_item.Date__c;
               Tedrow_item.hour = (integer) ted_item.Hour__c;
               Tedrow_item.day = ted_item.Date_Day_value__c; //checking if date is not null
               Tedrow_item.Tedid  = ted_item.id;
               Tedrow_item.Teid = ted_item.Time_Entry__c;
        }
}

Public void addrows5(){
     
  for(integer i=0;i<5;i++)
            {
             Time_Entry_Detail__c tedt = new Time_Entry_Detail__c();
             Tedt_list.add(tedt); 
            }
}
 

public PageReference back1() {

    PageReference reRend = new PageReference('/apex/timeentryexp');
    reRend.setRedirect(false);
    return reRend;

}

Public void save1(){



}








}







 
  • August 23, 2016
  • Like
  • 0
Hi friends,

I am new to vf page development. My requirement is to bring 5*8 matrix format in page block table.Under Activity column I want bring repeated picklist for 5 rows. And for Sun to Sat columns to bring repeated input field text box for 5 rows. 

Here I have attached my code pls help on this.

My desired output is
User-added image

VF Page
 
<apex:page showHeader="false" sidebar="false" controller="timeentrydetails" >
    <apex:form >
        <apex:pageBlock title="Time Entry Details Page">
            <apex:pageBlockButtons location="top" >
                <apex:CommandButton value="Save"/>
                <apex:CommandButton value="Submitted"/>
                <apex:CommandButton value="Addrows"/>
                <apex:CommandButton value="Back"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!Time_entry_dt_list }" var="tm">
                <apex:column headerValue="Activity"  />
                <apex:column headerValue="SUN"  />
                <apex:column headerValue="MON"  />
                <apex:column headerValue="TUE"  />
                <apex:column headerValue="WED"  />
                <apex:column headerValue="THU"  />
                <apex:column headerValue="FRI"  />
                <apex:column headerValue="SAT"  />
                
            </apex:pageBlockTable>
        
        </apex:pageBlock>
    
    
    </apex:form>
      
 
</apex:page>

Controller
 
public class timeentrydetails {

Public Class Timeentrydetrow{
        Public Id Tmrowid {get;set;}
        Public String Activity {get;set;}
        Public Integer Hour {get;set;}
        
    
    }
    
    
    Public List<Timeentrydetrow> Time_entry_dt_list {get;set;}
    
    Public timeentrydetails(){
    
        Time_entry_dt_list = new List<Timeentrydetrow>();
        Timeentrydetrow tmd;
        
        for(Time_Entry_Detail__c tmed : [Select Activity__c,Hour__c from Time_Entry_Detail__c ]){
            Timeentrydetrow tr = new Timeentrydetrow();
        
        
        
        
        }
    


      
  
}


}
Regards
Jayabalaji


 
  • August 16, 2016
  • Like
  • 0
Hi friends,

I want to convert this value Sun Jun 12 00:00:00 GMT 2016 into date format 06/12/2016(MM/DD/YYYY) format. I am using custom controller. While fetching data from time_entry object its showing in VF page like this Sun Jun 12 00:00:00 GMT 2016. So while showing in page I want dd/mm/yyyy format. Here I attached my code . Please help on this.
 
<apex:page standardController="Time_Entry__c" showHeader="false" sidebar="false" standardStylesheets="true" recordSetVar="timelist" >
  <apex:form >
      <apex:pageBlock title="Time Entry Page" >
          <apex:pageBlockButtons location="top" >
                  <apex:commandButton value="Select"/>
                   </apex:pageBlockButtons>   
         
            <apex:selectList multiselect="false" size="1"  >
                  <apex:selectOption itemValue="MON" itemLabel="--Month--">  </apex:selectOption> 
                  <apex:selectOption itemValue="JAN" itemLabel="January">  </apex:selectOption> 
                  <apex:selectOption itemValue="FEB" itemLabel="February"> </apex:selectOption>
                  <apex:selectOption itemValue="MAR" itemLabel="March"> </apex:selectOption>
                  <apex:selectOption itemValue="APR" itemLabel="April"> </apex:selectOption>     
                  <apex:selectOption itemValue="MAY" itemLabel="May"> </apex:selectOption> 
                  <apex:selectOption itemValue="JUN" itemLabel="June"> </apex:selectOption> 
                  <apex:selectOption itemValue="JUL" itemLabel="July"> </apex:selectOption> 
                  <apex:selectOption itemValue="AUG" itemLabel="August"> </apex:selectOption> 
                  <apex:selectOption itemValue="SEP" itemLabel="September"> </apex:selectOption> 
                  <apex:selectOption itemValue="OCT" itemLabel="October"> </apex:selectOption> 
                  <apex:selectOption itemValue="NOV" itemLabel="November"> </apex:selectOption> 
                  <apex:selectOption itemValue="DEC" itemLabel="December"> </apex:selectOption> 
              </apex:selectList>
              <apex:selectList multiselect="false" size="1">
                  <apex:selectOption itemValue="YEAR" itemLabel="--Year--">  </apex:selectOption> 
                  <apex:selectOption itemValue="2016" itemLabel="2016">  </apex:selectOption> 
                  <apex:selectOption itemValue="2017" itemLabel="2017">  </apex:selectOption> 
                  <apex:selectOption itemValue="2018" itemLabel="2018">  </apex:selectOption> 
                  <apex:selectOption itemValue="2019" itemLabel="2019">  </apex:selectOption> 
                  <apex:selectOption itemValue="2020" itemLabel="2020">  </apex:selectOption> 
              </apex:selectList>
                   
                   
        
                <apex:pageBlockTable value="{!timelist}" var="t" columns="4">
                <apex:column width="25%" > <apex:outputLink value="/apex/te_detail?idx={!t.id}">{!t.name}</apex:outputLink> </apex:column>
                <apex:column value="{!t.Time_From_Date__c}"/>
                <apex:column value="{!t.Time_To_Date__c}"/>
                <apex:column value="{!t.Status__c}"/>
          </apex:pageBlockTable>         
         
          
      </apex:pageBlock>
  </apex:form>
</apex:page>

Controller is
 
Public class Wrapperclassdemo{
    /* Our Wrapper Class */
    Public Class Tablerow{
        Public Date Fromdate {get;set;}
        Public Date Todate {get;set;}
        Public String Status {get;set;}
        Public String Name {get;set;}
        
    
    }
    /*Public Property that will hold all the Tablerows and our PageBlockTable can use this Variable   to get the whole List of rows*/
    Public List<Tablerow> Rowlist {get;set;}
    
    /*Constructor that runs a SOQL to get all the Records and build the List. This get executed automatically on the Page Load.*/
    Public Wrapperclassdemo(){
        Rowlist = new List<Tablerow>();
        Tablerow tr;
        /*Building the List of TableRows*/
        /*Fetch all the Contacts and then build the List*/
        
        

    } 
    
   Public void select1(){
   
          for(Time_Entry__c tm : [Select Name, Time_From_Date__c,Time_To_Date__c,Status__c from Time_Entry__c ]){
            Tablerow tr = new Tablerow();
            tr.Fromdate = tm.Time_From_Date__c;
            tr.Todate = tm.Time_To_Date__c;
            tr.Status = tm.Status__c;
            tr.Name = tm.Name;
            
            /*Add the TableRow to the List then and there*/
            
            Rowlist.add(tr);
                
        }
   
   
   
   }
}

 
Hi all, 

I want to fetch recods from custom object time_entry__c and show in one VF page with condition month and year selected in vf page and same time it should retrive as per logged user records only need to show. I am new to salesforce please guys help on this

Regards
Sreejayabalajee

 
Hi All

While creating a record from Candidate object to emplyee object using custom button on click on javascript behavior. I got the following error.

A problem with the onclick javascript encountered unexpected number.

Code is here

{!REQUIRESCRIPT('/soap/ajax/36.0/connection.js')}

 
var emp = new sforce.SObject('Employee__c');

 emp.Employee_First_Name__c =  {!Candidate__c.First_Name__c};
emp.Employee_Last_Name__c = {!Candidate__c.Last_Name__c};
emp.Mobile_No__c = {!Candidate__c.Mobile_No__c};
emp.Personal_Email__c = {!Candidate__c.Email__c};
emp.Employee_Address1__c = {!Candidate__c.Address1__c};
emp.Employee_Address2__c = {!Candidate__c.Address2__c};
emp.City__c = {!Candidate__c.City__c};
emp.State__c = {!Candidate__c.State__c};
emp.Zip_Postal_Code__c = {!Candidate__c.Zip_Postal_Code__c};


  
result = sforce.connection.create([emp]);

 
if(result[0].success == 'true')
{
    alert('A New Employee with Name - ' + emp.Eismployee_First_Name__c + ' was Created Successfully.');
}

Any one help on this... I am very new to salesforce and javascript... pls help on this


 
Hi friends,

I am new to vf page development. My requirement is to bring 5*8 matrix format in page block table.Under Activity column I want bring repeated picklist for 5 rows. And for Sun to Sat columns to bring repeated input field text box for 5 rows. 

Here I have attached my code pls help on this.

My desired output is
User-added image

VF Page
 
<apex:page showHeader="false" sidebar="false" controller="timeentrydetails" >
    <apex:form >
        <apex:pageBlock title="Time Entry Details Page">
            <apex:pageBlockButtons location="top" >
                <apex:CommandButton value="Save"/>
                <apex:CommandButton value="Submitted"/>
                <apex:CommandButton value="Addrows"/>
                <apex:CommandButton value="Back"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!Time_entry_dt_list }" var="tm">
                <apex:column headerValue="Activity"  />
                <apex:column headerValue="SUN"  />
                <apex:column headerValue="MON"  />
                <apex:column headerValue="TUE"  />
                <apex:column headerValue="WED"  />
                <apex:column headerValue="THU"  />
                <apex:column headerValue="FRI"  />
                <apex:column headerValue="SAT"  />
                
            </apex:pageBlockTable>
        
        </apex:pageBlock>
    
    
    </apex:form>
      
 
</apex:page>

Controller
 
public class timeentrydetails {

Public Class Timeentrydetrow{
        Public Id Tmrowid {get;set;}
        Public String Activity {get;set;}
        Public Integer Hour {get;set;}
        
    
    }
    
    
    Public List<Timeentrydetrow> Time_entry_dt_list {get;set;}
    
    Public timeentrydetails(){
    
        Time_entry_dt_list = new List<Timeentrydetrow>();
        Timeentrydetrow tmd;
        
        for(Time_Entry_Detail__c tmed : [Select Activity__c,Hour__c from Time_Entry_Detail__c ]){
            Timeentrydetrow tr = new Timeentrydetrow();
        
        
        
        
        }
    


      
  
}


}
Regards
Jayabalaji


 
  • August 16, 2016
  • Like
  • 0
Hi friends,

I want to convert this value Sun Jun 12 00:00:00 GMT 2016 into date format 06/12/2016(MM/DD/YYYY) format. I am using custom controller. While fetching data from time_entry object its showing in VF page like this Sun Jun 12 00:00:00 GMT 2016. So while showing in page I want dd/mm/yyyy format. Here I attached my code . Please help on this.
 
<apex:page standardController="Time_Entry__c" showHeader="false" sidebar="false" standardStylesheets="true" recordSetVar="timelist" >
  <apex:form >
      <apex:pageBlock title="Time Entry Page" >
          <apex:pageBlockButtons location="top" >
                  <apex:commandButton value="Select"/>
                   </apex:pageBlockButtons>   
         
            <apex:selectList multiselect="false" size="1"  >
                  <apex:selectOption itemValue="MON" itemLabel="--Month--">  </apex:selectOption> 
                  <apex:selectOption itemValue="JAN" itemLabel="January">  </apex:selectOption> 
                  <apex:selectOption itemValue="FEB" itemLabel="February"> </apex:selectOption>
                  <apex:selectOption itemValue="MAR" itemLabel="March"> </apex:selectOption>
                  <apex:selectOption itemValue="APR" itemLabel="April"> </apex:selectOption>     
                  <apex:selectOption itemValue="MAY" itemLabel="May"> </apex:selectOption> 
                  <apex:selectOption itemValue="JUN" itemLabel="June"> </apex:selectOption> 
                  <apex:selectOption itemValue="JUL" itemLabel="July"> </apex:selectOption> 
                  <apex:selectOption itemValue="AUG" itemLabel="August"> </apex:selectOption> 
                  <apex:selectOption itemValue="SEP" itemLabel="September"> </apex:selectOption> 
                  <apex:selectOption itemValue="OCT" itemLabel="October"> </apex:selectOption> 
                  <apex:selectOption itemValue="NOV" itemLabel="November"> </apex:selectOption> 
                  <apex:selectOption itemValue="DEC" itemLabel="December"> </apex:selectOption> 
              </apex:selectList>
              <apex:selectList multiselect="false" size="1">
                  <apex:selectOption itemValue="YEAR" itemLabel="--Year--">  </apex:selectOption> 
                  <apex:selectOption itemValue="2016" itemLabel="2016">  </apex:selectOption> 
                  <apex:selectOption itemValue="2017" itemLabel="2017">  </apex:selectOption> 
                  <apex:selectOption itemValue="2018" itemLabel="2018">  </apex:selectOption> 
                  <apex:selectOption itemValue="2019" itemLabel="2019">  </apex:selectOption> 
                  <apex:selectOption itemValue="2020" itemLabel="2020">  </apex:selectOption> 
              </apex:selectList>
                   
                   
        
                <apex:pageBlockTable value="{!timelist}" var="t" columns="4">
                <apex:column width="25%" > <apex:outputLink value="/apex/te_detail?idx={!t.id}">{!t.name}</apex:outputLink> </apex:column>
                <apex:column value="{!t.Time_From_Date__c}"/>
                <apex:column value="{!t.Time_To_Date__c}"/>
                <apex:column value="{!t.Status__c}"/>
          </apex:pageBlockTable>         
         
          
      </apex:pageBlock>
  </apex:form>
</apex:page>

Controller is
 
Public class Wrapperclassdemo{
    /* Our Wrapper Class */
    Public Class Tablerow{
        Public Date Fromdate {get;set;}
        Public Date Todate {get;set;}
        Public String Status {get;set;}
        Public String Name {get;set;}
        
    
    }
    /*Public Property that will hold all the Tablerows and our PageBlockTable can use this Variable   to get the whole List of rows*/
    Public List<Tablerow> Rowlist {get;set;}
    
    /*Constructor that runs a SOQL to get all the Records and build the List. This get executed automatically on the Page Load.*/
    Public Wrapperclassdemo(){
        Rowlist = new List<Tablerow>();
        Tablerow tr;
        /*Building the List of TableRows*/
        /*Fetch all the Contacts and then build the List*/
        
        

    } 
    
   Public void select1(){
   
          for(Time_Entry__c tm : [Select Name, Time_From_Date__c,Time_To_Date__c,Status__c from Time_Entry__c ]){
            Tablerow tr = new Tablerow();
            tr.Fromdate = tm.Time_From_Date__c;
            tr.Todate = tm.Time_To_Date__c;
            tr.Status = tm.Status__c;
            tr.Name = tm.Name;
            
            /*Add the TableRow to the List then and there*/
            
            Rowlist.add(tr);
                
        }
   
   
   
   }
}

 
Hi all, 

I want to fetch recods from custom object time_entry__c and show in one VF page with condition month and year selected in vf page and same time it should retrive as per logged user records only need to show. I am new to salesforce please guys help on this

Regards
Sreejayabalajee

 
Hi All

While creating a record from Candidate object to emplyee object using custom button on click on javascript behavior. I got the following error.

A problem with the onclick javascript encountered unexpected number.

Code is here

{!REQUIRESCRIPT('/soap/ajax/36.0/connection.js')}

 
var emp = new sforce.SObject('Employee__c');

 emp.Employee_First_Name__c =  {!Candidate__c.First_Name__c};
emp.Employee_Last_Name__c = {!Candidate__c.Last_Name__c};
emp.Mobile_No__c = {!Candidate__c.Mobile_No__c};
emp.Personal_Email__c = {!Candidate__c.Email__c};
emp.Employee_Address1__c = {!Candidate__c.Address1__c};
emp.Employee_Address2__c = {!Candidate__c.Address2__c};
emp.City__c = {!Candidate__c.City__c};
emp.State__c = {!Candidate__c.State__c};
emp.Zip_Postal_Code__c = {!Candidate__c.Zip_Postal_Code__c};


  
result = sforce.connection.create([emp]);

 
if(result[0].success == 'true')
{
    alert('A New Employee with Name - ' + emp.Eismployee_First_Name__c + ' was Created Successfully.');
}

Any one help on this... I am very new to salesforce and javascript... pls help on this