• vishnu1
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

i created a time card for 2 projects.now i want to place a combo box which will automatically populate project names and when i select one project it should display the corresponding time card.The following code will show a combo box but it  is static and didnt rerieve the project name dynamically.

 

 

<apex:selectList id="chooseproject" value="{!project1}" size="1" multiselect="false">
<apex:selectOption itemValue="TimeCardManagement" itemLabel="TimeCardManagement"/>
<apex:selectOption itemValue="TimeCard" itemLabel="TimeCard"/>
</apex:selectList>

 Following is my VF code

 

<apex:page showHeader="false" sidebar="false" controller="CTRLNEWASSIGNMENT">
 <font size="3" color="Red"> <marquee behavior="alternate">You are now viewing the Time Card</marquee> </font> 
 <center>  <br/><br/><br/><br/><br/>  <h1> <font size="4" color="Grey"> WELCOME USER,PLEASE ENTER THE WORKING HOURS</font> </h1> <br/><br/>
 <h1><font size="4" color="Green">Today is {! Day(TODAY())}-{! Month(TODAY())}-{!Year(TODAY())}</font></h1></center><br/><br/><br/><br/><br/><br/>
 <apex:form >
  <br/><br/>

 <center><table>
     <tr>
         
     </tr>
     <tr>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;<font size="4" color="blue">Time Card</font></td>
        
         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mon-{! day(TODAY())}-{! Year(Today())}</td>
         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tus-{! day(TODAY()+1)}-{! Year(Today())}</td>
         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wed-{! day(TODAY()+2)}-{! Year(Today())}</td>
         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thu-{! day(TODAY()+3)}-{! Year(Today())}</td>
         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fri-{! day(TODAY()+4)}-{! Year(Today())}</td>
         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sat-{! day(TODAY()+5)}-{! Year(Today())}</td>
         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sun-{! day(TODAY()+6)}-{! Year(Today())}</td>
         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TOTAL </td>
            </tr>
     <tr>
         
         <td></td>
     </tr>
     <tr>
         <td>&nbsp;&nbsp;&nbsp;&nbsp;<font size="4" color="green">Project</font></td>
         <td></td>
     </tr>
     <tr>
         <td>&nbsp;&nbsp;&nbsp;&nbsp;<apex:inputText value="{!project1}"/></td>
         
         <td><apex:inputText value="{!mon}" size="12"/></td>
         <td><apex:inputText value="{!tus}" size="12"/></td>
         <td><apex:inputText value="{!wed}" size="12"/></td>
         <td><apex:inputText value="{!thu}" size="12"/></td>
         <td><apex:inputText value="{!fri}" size="12"/></td>
         <td><apex:inputText value="{!sat}" size="12"/></td>
         <td><apex:inputText value="{!sun}" size="12"/></td>
         <td><apex:inputText value="{!total}" size="12"/></td>
     </tr>
     <tr>
         <td>&nbsp;&nbsp;&nbsp;&nbsp;<apex:inputText value="{!project2}"/></td>
         
         <td><apex:inputText value="{!mon1}" size="12"/></td>
         <td><apex:inputText value="{!tus1}" size="12"/></td>
         <td><apex:inputText value="{!wed1}" size="12"/></td>
         <td><apex:inputText value="{!thu1}" size="12"/></td>
         <td><apex:inputText value="{!fri1}" size="12"/></td>
         <td><apex:inputText value="{!sat1}" size="12"/></td>
         <td><apex:inputText value="{!sun1}" size="12"/></td>
         <td><apex:inputText value="{!total1}" size="12"/></td>
     </tr>
     <tr>
     
      <center>
         <td><apex:commandButton value="Save" action="{! addto}"/></td>
         <td><apex:commandButton value="Clear Fields" action="{! clear}"/></td>
           <td><apex:commandButton value="Total Working Hours" action="{! total}"/></td><br></br>
                      
       </center>
     </tr>

    
 </table></center>
 
  <apex:selectList id="chooseproject" value="{!project1}" size="1" multiselect="false">
<apex:selectOption itemValue="TimeCardManagement" itemLabel="TimeCardManagement"/>
<apex:selectOption itemValue="TimeCard" itemLabel="TimeCard"/>
</apex:selectList>

<td><apex:commandButton value="View Timecard" action="{! view}"/></td>
 </apex:form>
</apex:page>

 Following is my apex code

 

public with sharing class CTRLNEWASSIGNMENT 
{

    public PageReference view() {
    
    return null;
        
    
}

   

          public CTRLNEWASSIGNMENT()
 
    {
        List<MyProject__c> pi = new  List<MyProject__c>();
        pi = [SELECT Name,ProjectDescription__c,ProjectID__c FROM  MyProject__c]; 
        
 }
    public PageReference clear() 
   
    {
              return null;
    }


    public PageReference addto() {
    
        TimeKeeper_c__c tc = new TimeKeeper_c__c();
        
        tc.SunHour__c = sun1;
        tc.SatHour__c = sat1;
        tc.MonHour__c = mon1;
        tc.TusHour__c = tus1;
        tc.WedHour__c = wed1;
        tc.ThuHour__c = thu1;
        tc.FriHour__c = fri1;
        
        insert tc;
        
 TimeKeeper_c__c tc1 = new TimeKeeper_c__c();

        tc1.SunHour__c = sun;
        tc1.SatHour__c = sat;
        tc1.MonHour__c = mon;
        tc1.TusHour__c = tus;
        tc1.WedHour__c = wed;
        tc1.ThuHour__c = thu;
        tc1.FriHour__c = fri;
        
        insert tc1;
        
        return null;
    }


    public Integer total1 { get; set; }

    public Integer sun1 { get; set; }

    public Integer sat1 { get; set; }

    public Integer fri1 { get; set; }

    public Integer thu1 { get; set; }

    public Integer wed1 { get; set; }

    public Integer tus1 { get; set; }

    public Integer mon1 { get; set; }

    public String project2 { get; set; }

    public Integer total { get; set; }

    public Integer sun { get; set; }

    public Integer sat { get; set; }

    public Integer fri { get; set; }

    public Integer thu { get; set; }

    public Integer wed { get; set; }

    public Integer tus { get; set; }

    public Integer mon { get; set; }

    public String project1 { get; set; }

    public PageReference total() {
    total =  Integer.valueOf(mon)+ Integer.valueOf(tus)+Integer.valueOf(wed)+Integer.valueOf(thu)+Integer.valueOf(fri)+Integer.valueOf(sat)+Integer.valueOf(sun);
     total1 = Integer.valueOf(mon1)+ Integer.valueOf(tus1)+Integer.valueOf(wed1)+Integer.valueOf(thu1)+Integer.valueOf(fri1)+Integer.valueOf(sat1)+Integer.valueOf(sun1);
        return null;
       
    }

}

 

 

 

 

Im new to salesforce chatter and tried to  update status through the following code

<apex:page>
<apex:form>
<apex:inputText value="{!status}" id="status" maxlength="100" />
<apex:commandLink style="button" value="Update User Status" action="{!doUserStatus}" />
</apex:form>
</apex:page>

but got an error like this "Error: Unknown property 'status' referenced in fFirst1"

plz help me out..?

Im new to salesforce chatter and tried to  update status through the following code

<apex:page>
<apex:form>
<apex:inputText value="{!status}" id="status" maxlength="100" />
<apex:commandLink style="button" value="Update User Status" action="{!doUserStatus}" />
</apex:form>
</apex:page>

but got an error like this "Error: Unknown property 'status' referenced in fFirst1"

plz help me out..?