• Rohit Paul
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 7
    Replies

Hi,

I need to place a validation on one of my date fields in a Customs Object.
The following validation is required:

Lets say, the date today is 4-June-2012.
I need to place a validation where if the user selects any date lesser than 1-May-2012 the system should prompt a message on the field stating that the "Update can be done for current and previous month only".

Which means that to create a record the date selection has to be within the current month and the previous month.

Kindly suggest.
Thanks

Hi,

 

Need to have a page where the inputText field must be activated only when the checkbox next to it is tagged.

Can you please provide me an example?

 

Thanks.

Hi All,

 

I am preparing a view where the user can select the name and get all the details on the page.

 

I require to present a General Overview table where i display some amounts to collect.

This amount can be negetive or positive.....

 

For that I require to add color to each row depending on the amount.

Amount <= 0 - Green

Amount >0 - Red

 

Please refer to the following image for the pageBlockTable layout of th VF page:

 

Layout of the page

 

Can this be done in VisualForce?

Please assist.

 

Hello All,

 

I am currently working on a page which displays the Name of the payer and the payee details.

This is my VF Page code:

 

<apex:page controller="newExpenditureController" >
  
  <apex:pageBlock >
  <p>Welcome, <b>{!$User.FirstName} {!$User.LastName}</b></p>
  <p>Please select any following options to proceed</p>
  </apex:pageBlock>
  <!-- Section containing all the Action Buttons -->
  <apex:form >
  <apex:pageBlock title="Select Choice">
  <apex:pageBlockSection >
      <apex:commandButton action="{!addExpend}" value="Add Expenditure" disabled="{!b_addexp}"></apex:commandButton>
      <apex:commandButton action="{!closeAll}" value="Close All" disabled="{!b_cloall}"></apex:commandButton>
  </apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
  
  <apex:pageBlock title="Create New Expenditure" mode="edit" rendered="{!addexp}">
  <apex:pageMessages />
  <apex:form >
  <apex:pageBlockSection columns="1">
  <apex:inputField value="{!bb.Date__c}"/>
  </apex:pageBlockSection>
  
  <apex:pageBlockSection columns="2" >
  <apex:inputField value="{!bb.Payed_By__c}" required="true" />
  <apex:inputField value="{!bb.Payed_For__c}" required="true" />
  </apex:pageBlockSection>
  
  <apex:pageBlockSection columns="2">
  <apex:inputField value="{!bb.Amount__c}"/>
  <apex:inputField value="{!bb.Description__c}" required="true"/>
  </apex:pageBlockSection>
  
  <apex:pageBlockSection >
  
  </apex:pageBlockSection>
  
  <!-- SAVE Option -->
  <center>
  <apex:pageBlockSection columns="1" showHeader="true">
  <apex:commandButton value="Save" action="{!save}"/>
  </apex:pageBlockSection>
  </center>
  
  </apex:form>
  </apex:pageBlock>
  <apex:form >
  <apex:pageBlock title="Current Details" mode="edit">
      <apex:dataTable value="{!Bill_Book}" var="bbc" width="100%">
      <apex:detail /> 
        <apex:column ><apex:facet name="header"><b>Payed By</b></apex:facet> {!bbc.Payed_By__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Payed For</b></apex:facet> {!bbc.Payed_For__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Amount</b></apex:facet> {!bbc.Amount__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Date</b></apex:facet> {!bbc.Date__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Description</b></apex:facet> {!bbc.Description__c}</apex:column>
        </apex:dataTable>
        </apex:pageBlock>
  </apex:form>
  
  
</apex:page>

 

And the following is my controller code:

 

public class newExpenditureController
{

    //Object Definition        
    public Boolean addexp {get; set;}
    public Boolean b_addexp {get; set;}
    public Boolean b_cloall {get; set;}
    public Bill_Book__c bb {get; set;}
    private final String RedirectUrl = 'https://c.ap1.visual.force.com/apex/New_Expenditure?sfdc.tabName=01r900000001gV7';
    ID id = null;   
    
    
    
    //Constructor    
    public newExpenditureController() 
    {
        Id id = ApexPages.currentPage().getParameters().get('id');    
        addexp = false;
        b_addexp = false;
        b_cloall = true;
        
        //object bb creation
        bb = new Bill_Book__c();       
    }
    
    public List<Bill_Book__c> getBill_Book()
    {
        return [SELECT
                    Payed_By__c,
                    Payed_For__c,
                    Amount__c,
                    Date__c,
                    Description__c
                    
                    FROM
                    
                    Bill_Book__c
                    
                    ORDER BY LastModifiedDate DESC LIMIT 10];
    }
    
    //Toggle Button
    public PageReference addExpend() 
    {
        //Page Access
        addexp = true;
        
        //Button access
        b_addexp = true;
        b_cloall = false;
       
        return null;
    }

    public Bill_Book__c getAccount() 
    {
        return bb;
    }
    
    public PageReference save() 
    {
        bb.Status__c = 'P';   
        try
        {
            upsert(bb);
        }
        catch(System.DMLException e) 
        {
            ApexPages.addMessages(e);
            return null;
        }
        return (redirectTab());
    }
    
    
    
    public PageReference closeAll() 
    {
        addexp = false;
                
        //Button access
        b_addexp = false;
        b_cloall = true;
        return null;
    }
    
    public String getName(String id)
    {    
        String name = null;
        name = [SELECT Name, Age__c FROM Person__c WHERE ID=:id].Name;
        return name;
    }
    
      
    public PageReference redirectTab()
    {          
       PageReference newPage = new PageReference(RedirectUrl);          
       newPage.setRedirect(true);  
       return newPage;  
    } 
        
}

 

This Object (Bill_Book__c ) has 2 lookup fields Payed_By__c and Payed_For__c, which link to another object Person__c through local relationship.

 

Currently this code provides me only the ID of the Payed By and Payed For details.

What I require is to display the First Name of these fields.

(First Name is a field of Person__c object)

 

Please help in this issue. Thanks.......... :)

Hi,

I need to place a validation on one of my date fields in a Customs Object.
The following validation is required:

Lets say, the date today is 4-June-2012.
I need to place a validation where if the user selects any date lesser than 1-May-2012 the system should prompt a message on the field stating that the "Update can be done for current and previous month only".

Which means that to create a record the date selection has to be within the current month and the previous month.

Kindly suggest.
Thanks

Hi,

 

Need to have a page where the inputText field must be activated only when the checkbox next to it is tagged.

Can you please provide me an example?

 

Thanks.

Hi All,

 

I am preparing a view where the user can select the name and get all the details on the page.

 

I require to present a General Overview table where i display some amounts to collect.

This amount can be negetive or positive.....

 

For that I require to add color to each row depending on the amount.

Amount <= 0 - Green

Amount >0 - Red

 

Please refer to the following image for the pageBlockTable layout of th VF page:

 

Layout of the page

 

Can this be done in VisualForce?

Please assist.

 

Hello All,

 

I am currently working on a page which displays the Name of the payer and the payee details.

This is my VF Page code:

 

<apex:page controller="newExpenditureController" >
  
  <apex:pageBlock >
  <p>Welcome, <b>{!$User.FirstName} {!$User.LastName}</b></p>
  <p>Please select any following options to proceed</p>
  </apex:pageBlock>
  <!-- Section containing all the Action Buttons -->
  <apex:form >
  <apex:pageBlock title="Select Choice">
  <apex:pageBlockSection >
      <apex:commandButton action="{!addExpend}" value="Add Expenditure" disabled="{!b_addexp}"></apex:commandButton>
      <apex:commandButton action="{!closeAll}" value="Close All" disabled="{!b_cloall}"></apex:commandButton>
  </apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
  
  <apex:pageBlock title="Create New Expenditure" mode="edit" rendered="{!addexp}">
  <apex:pageMessages />
  <apex:form >
  <apex:pageBlockSection columns="1">
  <apex:inputField value="{!bb.Date__c}"/>
  </apex:pageBlockSection>
  
  <apex:pageBlockSection columns="2" >
  <apex:inputField value="{!bb.Payed_By__c}" required="true" />
  <apex:inputField value="{!bb.Payed_For__c}" required="true" />
  </apex:pageBlockSection>
  
  <apex:pageBlockSection columns="2">
  <apex:inputField value="{!bb.Amount__c}"/>
  <apex:inputField value="{!bb.Description__c}" required="true"/>
  </apex:pageBlockSection>
  
  <apex:pageBlockSection >
  
  </apex:pageBlockSection>
  
  <!-- SAVE Option -->
  <center>
  <apex:pageBlockSection columns="1" showHeader="true">
  <apex:commandButton value="Save" action="{!save}"/>
  </apex:pageBlockSection>
  </center>
  
  </apex:form>
  </apex:pageBlock>
  <apex:form >
  <apex:pageBlock title="Current Details" mode="edit">
      <apex:dataTable value="{!Bill_Book}" var="bbc" width="100%">
      <apex:detail /> 
        <apex:column ><apex:facet name="header"><b>Payed By</b></apex:facet> {!bbc.Payed_By__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Payed For</b></apex:facet> {!bbc.Payed_For__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Amount</b></apex:facet> {!bbc.Amount__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Date</b></apex:facet> {!bbc.Date__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Description</b></apex:facet> {!bbc.Description__c}</apex:column>
        </apex:dataTable>
        </apex:pageBlock>
  </apex:form>
  
  
</apex:page>

 

And the following is my controller code:

 

public class newExpenditureController
{

    //Object Definition        
    public Boolean addexp {get; set;}
    public Boolean b_addexp {get; set;}
    public Boolean b_cloall {get; set;}
    public Bill_Book__c bb {get; set;}
    private final String RedirectUrl = 'https://c.ap1.visual.force.com/apex/New_Expenditure?sfdc.tabName=01r900000001gV7';
    ID id = null;   
    
    
    
    //Constructor    
    public newExpenditureController() 
    {
        Id id = ApexPages.currentPage().getParameters().get('id');    
        addexp = false;
        b_addexp = false;
        b_cloall = true;
        
        //object bb creation
        bb = new Bill_Book__c();       
    }
    
    public List<Bill_Book__c> getBill_Book()
    {
        return [SELECT
                    Payed_By__c,
                    Payed_For__c,
                    Amount__c,
                    Date__c,
                    Description__c
                    
                    FROM
                    
                    Bill_Book__c
                    
                    ORDER BY LastModifiedDate DESC LIMIT 10];
    }
    
    //Toggle Button
    public PageReference addExpend() 
    {
        //Page Access
        addexp = true;
        
        //Button access
        b_addexp = true;
        b_cloall = false;
       
        return null;
    }

    public Bill_Book__c getAccount() 
    {
        return bb;
    }
    
    public PageReference save() 
    {
        bb.Status__c = 'P';   
        try
        {
            upsert(bb);
        }
        catch(System.DMLException e) 
        {
            ApexPages.addMessages(e);
            return null;
        }
        return (redirectTab());
    }
    
    
    
    public PageReference closeAll() 
    {
        addexp = false;
                
        //Button access
        b_addexp = false;
        b_cloall = true;
        return null;
    }
    
    public String getName(String id)
    {    
        String name = null;
        name = [SELECT Name, Age__c FROM Person__c WHERE ID=:id].Name;
        return name;
    }
    
      
    public PageReference redirectTab()
    {          
       PageReference newPage = new PageReference(RedirectUrl);          
       newPage.setRedirect(true);  
       return newPage;  
    } 
        
}

 

This Object (Bill_Book__c ) has 2 lookup fields Payed_By__c and Payed_For__c, which link to another object Person__c through local relationship.

 

Currently this code provides me only the ID of the Payed By and Payed For details.

What I require is to display the First Name of these fields.

(First Name is a field of Person__c object)

 

Please help in this issue. Thanks.......... :)