• Dhananjaya Bulugahamulle
  • NEWBIE
  • 105 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 18
    Replies
User-added image
I want to redirect to a new page (pagebpc) when user hit Save and Review button if above check box is checked. Otherwise it should goes to view page as it is on the extension. How do you add code for if it is checked, redirect to new and, If it is not, just the way it is. Thanks

Input field for check box
<apex:inputField value="{!Product_Brief__c.Bioprocess_Container_Customization_Reqd__c}" />
Save Button​
<apex:commandButton value="Save & Review" action="{!next}"/>
Extension​
public PageReference next() {
    if(controller.save() == null) {
    return null;}
    PageReference ref = Page.gibcopb2;
    ref.getParameters().put('id', controller.getId());
    ref.setRedirect(true);
    return ref;
}



 
VF page 
<apex:form id="theForm">
<apex:pageBlock id="thePageBlock">
 <apex:inputField value="{!Product_Brief__c.Product_Format__c}" onchange="myPicklistChanged();" id="myPicklist"/>

<table id="table_section4" align="center">
                <tr>
                    <th>QUANTITY</th>
                    <th>UNIT SIZE FILL VOLUME</th> 
                    <th class="Hidecolumn">LIQUID PACKAGING</th>
                    <th>POWDER AGT PACKAGING</th>
                    <th>TOTAL VOLUME:</th>
                </tr>
                <tr>
                    <td><apex:inputField value="{!Product_Brief__c.Quantity1_1__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_1__c}"/></td> 
                    <td class="Hidecolumn"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_1__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_1__c}" /></td>
                    <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_1__c}"/></td> 
                </tr>
                <tr>
                    <td><apex:inputField value="{!Product_Brief__c.Quantity1_2__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_2__c}"/></td> 
                    <td class="Hidecolumn"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_2__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_2__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_2__c}"/></td>
                </tr>
                <tr>
                    <td><apex:inputField value="{!Product_Brief__c.Quantity1_3__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_3__c}"/></td> 
                    <td class="Hidecolumn"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_3__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_3__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_3__c}"/></td>
                </tr>
                <tr>
                    <td><apex:inputField value="{!Product_Brief__c.Quantity1_4__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_4__c}"/></td> 
                    <td class="Hidecolumn"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_4__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_4__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_4__c}"/></td>
                </tr>
     <apex:pageBlock >
</apex:form>

JavaScript 

function myPicklistChanged(){
        var myPicklistElement = document.getElementById('{!$Component.theForm.thePageBlock.thePageBlockSection.myPicklist}');
        var myPicklistValue = myPicklistElement.options[myPicklistElement.selectedIndex].value;

        if (myPicklistValue == 'Biochemical Repack' || myPicklistValue == 'AO Powder' || myPicklistValue == 'AGT™ (Advanced Granulation)'  ){
            document.getElementByClassName("Hidecolumn").style.visibility = "hidden";
            
            }
        }

When User Select those value from pic list I want to hide the rows (Class = HideColumn). but it wont work. any body have any idea why? 
User-added image
I have a Pick list called myPicklist, when user select the  “Biochemical Repack” pick list values, I want to Hide the column from above table (Id = “HideColunm”), and when user select “AO Powder” I want to inactive the column. Any other values should show the column. So far I would be able to hide, but when I select another value from pick list it does nothing. Nothing will change, it will stay same. Does anybody know how to change that? Thanks
 
<apex:page standardController="Product_Brief__c" extensions="gibco" >
	<apex:form id="theForm">
		<apex:pageBlock id="thePageBlock">
			<apex:pageBlockSection id="thePageBlockSection">
                <apex:inputField value="{!Product_Brief__c.Product_Format__c}" onchange="myPicklistChanged();" id="myPicklist"/>
            </apex:pageBlockSection>
			
			<table id="table_section4" align="center">
                    <tr>
                        <th>QUANTITY</th>
                        <th>UNIT SIZE FILL VOLUME</th> 
                        <th Id="Hidecolumn">LIQUID
PACKAGING</th>
                        <th>POWDER AGT
PACKAGING</th>
                        <th>TOTAL
VOLUME:</th>
                    </tr>
                    <tr>
                        <td><apex:inputField value="{!Product_Brief__c.Quantity1_1__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_1__c}"/></td> 
                        <td Id="Hidecolumn1"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_1__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_1__c}" /></td>
                        <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_1__c}"/></td> 
                    </tr>
                    <tr>
                        <td><apex:inputField value="{!Product_Brief__c.Quantity1_2__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_2__c}"/></td> 
                        <td id="Hidecolumn2"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_2__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_2__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_2__c}"/></td>
                    </tr>
                    <tr>
                        <td><apex:inputField value="{!Product_Brief__c.Quantity1_3__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_3__c}"/></td> 
                        <td id="Hidecolumn3"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_3__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_3__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_3__c}"/></td>
                    </tr>
                    <tr>
                        <td><apex:inputField value="{!Product_Brief__c.Quantity1_4__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_4__c}"/></td> 
                        <td id="Hidecolumn4"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_4__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_4__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_4__c}"/></td>
                    </tr>
                    <tr>
                        <td><apex:inputField value="{!Product_Brief__c.Quantity1_5__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_5__c}"/></td> 
                        <td id="Hidecolumn5"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_5__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_5__c}"/></td>
                        <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_5__c}"/></td>
                    </tr>
                </table>
			</apex:pageBlock>
	</apex:form>
</apex:page>

<script>
              
        function myPicklistChanged(){
            var myPicklistElement = document.getElementById('{!$Component.theForm.thePageBlock.thePageBlockSection.myPicklist}');
            var myPicklistValue = myPicklistElement.options[myPicklistElement.selectedIndex].value;
                    
            if (myPicklistValue == 'Biochemical Repack'){
                document.getElementById("Hidecolumn").style.visibility = "hidden";
                document.getElementById("Hidecolumn1").style.visibility = "hidden";
                document.getElementById("Hidecolumn2").style.visibility = "hidden";
                document.getElementById("Hidecolumn3").style.visibility = "hidden";
                document.getElementById("Hidecolumn4").style.visibility = "hidden";
                document.getElementById("Hidecolumn5").style.visibility = "hidden";
                }
            else if (myPicklistValue == 'AO Powder'){
                document.getElementById("Hidecolumn").disabled = true; 
                document.getElementById("Hidecolumn1").disabled = true; 
                document.getElementById("Hidecolumn2").disabled = true; 
                document.getElementById("Hidecolumn3").disabled = true; 
                document.getElementById("Hidecolumn4").disabled = true; 
                document.getElementById("Hidecolumn5").disabled = true; 
            }
        }
</script>

 
User-added image
I have a pick list called System Size(System_Size_SUB_2013__c). When I select 2000L SUB from pick list, I want to give an alert to the user. (Only for a 2000L SUB, Not all of them). Any idea how to do that? Thanks

Field
<apex:inputField value="{!Product_Brief__c.System_Size_SUB_2013__c}" required="true"/>

 
I have a two dependent pick list.

System Size - 50L S.U.B. - 100L S.U.B. - 250L S.U.B. - 500L S.U.B. - 1000L S.U.B. - 2000L S.U.B.

Cable Management Tree - Right Side - Left Side - No Cable Management Tree Needed

If I select 2000L SUB from System Size I want to hide ( or Deactivate) Right and Left Side values from Cable management pick list. I only want to select No Cable Management Tree Needed, when System size is 2000L SUB. Does anybody have any idea, how to put a Validation rule or something that work for my problem (Only show "No Cable Management Tree Needed" in Cable Management pick list when someone select "2000 L SUB" in System Size pick list). Thanks. 

Note - Dependent pick list ​does not work for this problem. Coz I already used for something else. 
<apex:page standardController="Product_Brief__c" extensions="test1">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection  collapsible="false" columns="2">
                <apex:inputField value="{!Product_Brief__c.System_Size_SUB_2013__c}" required="true"/>
                <apex:inputField value="{!Product_Brief__c.Cable_Management_Tree__c}"/>
            </apex:pageBlockSection>
         </apex:pageBlock >
     </apex:form >

 
I found a code for sending email from apex. The problem is it have a part i do not want. If i remove below part it wont work. Any idea how to remove below part (div Id= "Remove Part"). Thanks 

VF Page 
<div Id= "Remove Part">
<apex:pageBlock title="Send an Email to Your {!account.name} Representatives">
    <p>Fill out the fields below to test how you might send an email to a user.</p><br />
        <apex:dataTable value="{!account.AccountTeamMembers}" var="contact" border="1">
            <apex:column ><apex:facet name="header">Name</apex:facet>{!contact.user.Name}</apex:column>
            <apex:column ><apex:facet name="header">Email</apex:facet>{!contact.user.Email}</apex:column>
        </apex:dataTable>
</div>
        <apex:commandButton value="Send Email" action="{!send}" /> 
</apex:pageBlock>

Extension 
public class gibco {
    
    public Product_Brief__c pb {get;set;}
    public User u {get;set;}
    
    private ApexPages.StandardController controller {get;set;}
    public boolean bUpdate {get;set;}
    public string loggedinUserId = UserInfo.getUserId();
    public User u2 = [Select ContactId From User where Id =: '005R0000001Y6h4'];
    
    public String ctId{
        get {
             ctId = u2.ContactId;
             return ctId;
            }
        set;
    }
         
    Contact ct = [SELECT AccountId, Name FROM Contact WHERE id=:ctId];
    Account acname = [SELECT Name FROM Account WHERE id=:ct.AccountId];
    public string getacct(){
        Account acct = [SELECT Name FROM Account WHERE id=:ct.AccountId];  
        return acct.Name;
        return null;
        }
         
    Opportunity opp = [SELECT Id FROM Opportunity WHERE AccountId=:ct.AccountId LIMIT 1];
    
 /* ********************* Email ************************* */
    public String subject { get; set; }
    public String body { get; set; }
    private Account account;

    public Account getAccount() {
    account = [select Name, (SELECT user.Name, user.email from AccountTeamMembers) 
                from Account where id = :ct.AccountId];
        return account;
    }

    public PageReference send() {
        // Define the email
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
         
        
    String addresses;
    if (account.AccountTeamMembers[0].user.Email != null)
    {
        addresses = account.AccountTeamMembers[0].user.Email;
        // Loop through the whole list of contacts and their emails
        for (Integer i = 1; i < account.AccountTeamMembers.size(); i++) 
        {
            if (account.AccountTeamMembers[i].user.Email != null)
            {
                addresses += ':' + account.AccountTeamMembers[i].user.Email;
            }
        }
    }

        String[] toAddresses = addresses.split(':', 0);

        // Sets the paramaters of the email
        email.setSubject( 'New Media/Buffer Product Brief from '  + ct.Name + ' at ' + acname.Name);
        email.setToAddresses( toAddresses );
        String htmlBody= 'Dear ' + ct.Name + ':<br/><br/>';
                htmlBody += 'This is a reminder that your review of ' + ct.Name + ' for the position of ' + 
                    ct.Name + ' has not been completed yet. Please complete this review as soon as possible.' +
                    '<br/><br/>Review Link: <a href=https://cs2.salesforce.com/' + ApexPages.currentPage().getParameters().get('id') + '>click here</a><br/><br/>Thank You,<br/>Recruiting Dept.';
                email.setHtmlBody(htmlBody);
    
        // Sends the email
        Messaging.SendEmailResult [] r = 
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); 
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Confirm,'The Product Breif has been submitted successfully. Thank you'));
        return null;
    }

 
I want to display an alert when user click on the Submit button. It should be display in <apex:Messages/> . Any Idea how to do that, I tried using onComplete="alert('Mail Sent')" but it just prompting a box. I want my alert in apex message field. thanks
 
<apex:form>
    <apex:messages><apex:messages/>
        <apex:pageBlock>
           <apex:pageblockButtons >
                <apex:commandButton value="Submit" action="{!send}" /> 
           </apex:pageblockButtons>
         <apex:pageBlock >
<apex:form >
 
ublic String subject { get; set; }
    public String body { get; set; }

    private Account account;
    public Account getAccount() {
    account = [select Name, (SELECT user.Name, user.email from AccountTeamMembers) 
                from Account where id = :ct.AccountId];
        return account;
    }

    public PageReference send() {
        // Define the email
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 

    String addresses;
    if (account.AccountTeamMembers[0].user.Email != null)
    {
        addresses = account.AccountTeamMembers[0].user.Email;
        // Loop through the whole list of contacts and their emails
        for (Integer i = 1; i < account.AccountTeamMembers.size(); i++) 
        {
            if (account.AccountTeamMembers[i].user.Email != null)
            {
                addresses += ':' + account.AccountTeamMembers[i].user.Email;
            }
        }
    }

        String[] toAddresses = addresses.split(':', 0);

        // Sets the paramaters of the email
        email.setSubject( 'New Media/Buffer Product Brief from '  + ct.Name + ' at ' + acname.Name);
        email.setToAddresses( toAddresses );
        String htmlBody= 'Dear ' + ct.Name + ':<br/><br/>';
                htmlBody += 'This is a reminder that your review of ' + ct.Name + ' for the position of ' + 
                    ct.Name + ' has not been completed yet. Please complete this review as soon as possible.' +
                    '<br/><br/>Review Link: <a href=https://cs2.salesforce.com/' + ApexPages.currentPage().getParameters().get('id') + '>click here</a><br/><br/>Thank You,<br/>Recruiting Dept.';
                email.setHtmlBody(htmlBody);

        // Sends the email
        Messaging.SendEmailResult [] r = 
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});   

        return null;
    }

 
HI, I have a Auto number field ({!Product_Brief__c.Name}). It will generate number after saving the page. If i put this field in my page before saving it will break my page. So i want show this output text field after saving, but i could not use rerendering option. Coz I already used it for editing the page. If i combine with it, it will not work is there any way i can do this. Thanks. 
<apex:page standardController="Product_Brief__c" sidebar="true" showHeader="true" extensions="gibco">
<apex:form id="theForm">
<apex:pageBlock id="myPanel">
<apex:pageBlockSection collapsible="false" title="Section 1: Custom Media Information (Required)" id="thePageBlockSection">
              
     <apex:outputText value="{!Product_Brief__c.Name}"></apex:outputText>
               
    <apex:inputField value="{!Product_Brief__c.Opportunity__r.Account.Name}" rendered="{!bEditMode}"/>
    <apex:outputField value="{!Product_Brief__c.Opportunity__r.Account.Name}" rendered="{!NOT(bEditMode)}"/>
    <apex:inputField value="{!Product_Brief__c.Customer_Number__c}" rendered="{!bEditMode}"/>
    <apex:outputField value="{!Product_Brief__c.Customer_Number__c}" rendered="{!NOT(bEditMode)}"/>
    <apex:inputField value="{!Product_Brief__c.Billing_Address__c}" rendered="{!bEditMode}"/>
    <apex:outputField value="{!Product_Brief__c.Billing_Address__c}" rendered="{!NOT(bEditMode)}"/>
    <apex:outputField value="{!Product_Brief__c.CreatedBy.Name}" rendered="{!NOT(bEditMode)}"/>
    <apex:inputField value="{!Product_Brief__c.Shipping_Address__c}" rendered="{!bEditMode}"/>
    <apex:outputField value="{!Product_Brief__c.Shipping_Address__c}" rendered="{!NOT(bEditMode)}"/></apex:pageBlockSection>

<apex:pageblockButtons >
   <apex:commandButton action="{!doToggleEditMode}" value="Edit" reRender="myPanel" rendered="{!NOT(bEditMode)}"/>
   <apex:commandButton action="{!doSave}" value="Save" reRender="myPanel" rendered="{!bEditMode}"/>
   <apex:commandButton value="Save" action="{!save}" id="c2" rendered="{!NOT(bEditMode)}"/>
   <apex:commandButton value="Print" onclick="window.print();" rendered="{!NOT(bEditMode)}"/>
   <apex:commandButton value="Cancel" action="{!Cancel}" rendered="{!NOT(bEditMode)}"/>
</apex:pageblockButtons>

Extention

public class gibco {
    
    public Product_Brief__c pb {get;set;}
    public User u {get;set;}
    
    private ApexPages.StandardController controller {get;set;}
    public boolean bUpdate {get;set;}
    public string loggedinUserId = UserInfo.getUserId();
    public User u2 = [Select ContactId From User where Id =: '005R0000001Y6h4'];
    
    public String ctId{
        get {
         //   if (ctId==null){
         //   if (bUpdate){
                  ctId = u2.ContactId;
         //       }
              return ctId;
         //   }
        }
        set;
    }
         
    Contact ct = [SELECT AccountId FROM Contact WHERE id=:ctId];
    public string getacct(){
        Account acct = [SELECT Name FROM Account WHERE id=:ct.AccountId];  
        return acct.Name;
        return null;
        }
         
    Opportunity opp = [SELECT Id FROM Opportunity WHERE AccountId=:ct.AccountId LIMIT 1];
    
/* *************** Edit Sec. ************************     */ 
    public Boolean bEditMode {
    get {
      if(bEditMode == null) {
          bEditmode = false;
          }
          return bEditMode;
      }
      set;
    }

    public PageReference doToggleEditMode() {
         bEditMode = !bEditMode;
            return null;
    }
    
    public PageReference doSave() {
        try {
        // Do your stuff to save your record
        controller.save();
        doToggleEditMode();
        }
        catch(Exception ex) {
        // Handle error
        }
    
        return null;
        }


Thanks
I have two pages with same fields. One page with input fields (Apex/page1), and the other one with output fields (Apex/page2). Any idea how to save and redirect to the page 2 with all values? 
 
User-added image
How do I add Page# of Total Page# in VF custom page? I only able to get Page#, I could not get the other part ( Of Total Page). Any Idea. Thanks 
 
<apex:panelGrid columns="9">
                <div id="panel">
                    <apex:commandLink action="{!first}">First</apex:commandlink>
                    <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandlink>
                    <apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink>
                    <apex:commandLink action="{!last}">Last</apex:commandlink> 
                    <apex:outputText value="Page #{!pageNumber}"/>
                    <b>Record :</b>
                    <apex:outputText rendered="{!(setpb.pageNumber * setpb.pageSize) < setpb.ResultSize}" value="{!setpb.pageNumber * setpb.pageSize} OF {!setpb.ResultSize}"></apex:outputText>
                    <apex:outputText rendered="{!(setpb.pageNumber * setpb.pageSize) >= setpb.ResultSize}" value="{!setpb.ResultSize} OF {!setpb.ResultSize}"></apex:outputText>
                  
                </div>
            </apex:panelGrid>
Extension 
 
public class DispatcherContactNewController {

    public DispatcherContactNewController(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    private integer offset; // Keeps track of the offset     
    private integer pageSize;   // Page size or number of rows           
    public integer totalRecords;  // Total number of records  
    
    public ApexPages.StandardSetController setpb{
        get{
            if(setpb == null){
                setpb = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT Id, Name, RecordTypeId, Createddate FROM Product_Brief__c ORDER BY Createddate DESC ]));
                         setpb.setPageSize(10);
                         }
                         return setpb;
           } 
        set;
        
    }
    
    public List<Product_Brief__c>getpbs(){
        return (List<Product_Brief__c>)setpb.getrecords();
    }
    
    public Boolean hasNext {
        get {
            return setpb.getHasNext();
            }
        set;
    }
    
    public Boolean hasPrevious {
        get {
            return setpb.getHasPrevious();
            }
        set;
    }
    
    public Integer pageNumber {
        get {
            return setpb.getPageNumber();
            }
        set;
    }
    
    public void first() {
         setpb.first();
    }
     
    public void last() {
         setpb.last();
    }

    // returns the previous page of records
    public void previous() {
        setpb.previous();
    }

    // returns the next page of records
    public void next() {
        setpb.next();
    }
}




 
User-added image
I figure it out when I click on the PB-005426 ({!p.Id}), to redirect to a new VF page layout (gibco2) with all vlues. But I have 5 different record type and VF pages. When user click on product brief number ({!p.Id}), I want to direct them to the right page. For Ex.

Record Type (RecordTypeId) = Media and Buffers then direct them to ('/apex/gibcopb2')
Record Type (RecordTypeId) = Hardware - S.U.B.then direct them to ('/apex/sum1')
Record Type (RecordTypeId) = BPC then direct them to ('/apex/page1')

In below code it only goes to one page('/apex/gibco2). I search for a example and could not find anything suitable for me. Most of them are confusing, and any idea how to assign multiple page according record type ID? Thanks.
<apex:page standardController="Product_Brief__c" extensions="DispatcherContactNewController">
</apex:pageBlock>
    </apex:form>
        <apex:pageBlock title="Recent Product Briefs">
            <apex:pageBlockTable value="{!pbs}" var="p" >
                <apex:column >
                    <apex:commandLink action="{! assetClicked}" value="{!P.Name}" id="theCommandLink"> 
                    <apex:param value="{!P.Id}" name="{!P.Id}" assignTo="{!selectedAsset}" ></apex:param>
                    </apex:commandLink>
                 </apex:column>
                 <apex:column value="{!p.RecordTypeId}"/>
            </apex:pageBlockTable> 
        </apex:pageBlock
    </apex:form>
</apex:pageBlock>

Extension
 
public class DispatcherContactNewController {

    public DispatcherContactNewController(ApexPages.StandardController controller) {
                this.controller = controller;
            }

    public ApexPages.StandardSetController setpb{
            get{
                if(setpb == null){
                    setpb = new ApexPages.StandardSetController(Database.getQueryLocator(
                        [SELECT Id, Name, RecordTypeId, Createddate FROM Product_Brief__c ORDER BY Createddate DESC ]));
                             setpb.setPageSize(10);
                             }
                             return setpb;
               } 
               set;
        }

        public List<Product_Brief__c>getpbs(){
            return (List<Product_Brief__c>)setpb.getrecords();
        }
/* ---------- For Redirect to New Page ------ */
 public string selectedAsset {get;set;}
    public PageReference assetClicked() 
    { 

    PageReference redirect = new PageReference('/apex/gibcopb2'); 

    // pass the selected asset ID to the new page
    redirect.getParameters().put('id',selectedAsset); 
    redirect.setRedirect(true); 

    return redirect;
    }
        }

 
I want to hide my save button (id="c2") when some one click one the edit button. i tried using j query, but it does not work. Does anybody have any idea? Thanks
 
<apex:pageblockButtons >
    <apex:commandButton action="{!doToggleEditMode}" value="Edit" reRender="myPanel" rendered="{!NOT(bEditMode)}" id="c1" />
    <apex:commandButton action="{!doSave}" value="Save" reRender="myPanel" rendered="{!bEditMode}" />
    <apex:commandButton value="PRINT" onclick="window.print();"/>
    <apex:commandButton value="Cancel" action="{!Cancel}"/>
    <apex:commandButton value="Save" action="{!save}" id="c2"/>
</apex:pageblockButtons>

Extension
 
public Boolean bEditMode {
get {
  if(bEditMode == null) {
      bEditmode = false;
      }
      return bEditMode;
  }
  set;
}

public PageReference doToggleEditMode() {
     bEditMode = !bEditMode;
        return null;
}

public PageReference doSave() {
    try {
    controller.save();
    doToggleEditMode();
    }
    catch(Exception ex) {
    }

    return null;
}

 
I have custom page, and when i try to save it my page does not save any information. I used different type of codes for saving. Most of them does not work and some of them break my page. Is there anything wrong with my code that i could not find? ( My main problem is it should save information and return to the same page with values) Any idea? Thanks
 
public class test1 {

    public Product_Brief__c pb {get;set;}
    public User u {get;set;}

    private ApexPages.StandardController controller {get;set;}
    public boolean bUpdate {get;set;}
    public string loggedinUserId = UserInfo.getUserId();
    public User u2 = [Select ContactId From User where Id =: '005R0000001Y6h4'];

    public String ctId{
        get {
                ctId = u2.ContactId;
                return ctId;
            }
        set;
    }

    Contact ct = [SELECT AccountId FROM Contact WHERE id=:ctId];
    public string getacct(){
        Account acct = [SELECT Name FROM Account WHERE id=:ct.AccountId];  
        return acct.Name;
        return null;
        }

    Opportunity opp = [SELECT Id FROM Opportunity WHERE AccountId=:ct.AccountId LIMIT 1];

   /* public PageReference save() {
        controller.save();{
        pageReference pg = new pageReference('/apex/pitu3');
        pg.setRedirect(true);
        pg .getParameters().put('id',controller.getId());
        return pg;
        }
        return null;
    } */

    /* public PageReference save() {
       controller.save(); 
       return null;
    }  */


   /* public PageReference save() {
    if(controller.save() != null) { 
    PageReference ref = Page.sumpage3; 
    ref.setRedirect(true); 
    return ref; 
    }
     return null;
    } */


    public PageReference save() {
        if(controller.save() != null) {
        PageReference congratsPage = Page.pitu3;
        congratsPage.setRedirect(true);
        congratsPage.getParameters().put('id',controller.getId());
        return congratsPage;
        }return null;
    }

    public test1(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    public PageReference page1(){
    return Page.pitu1;
    }

    public PageReference page2(){
    return Page.pitu2;
    }

    public PageReference page3(){
    return Page.pitu3;
    }

    public PageReference page4(){  
    return Page.pitu4;
    }

    public PageReference page5(){
    return Page.pitu5;
    }

}

 
I have a record table. I want to make product brief number clickable. When user click on the product brief number it will take to the record (open the product brief). Does anybody have idea? Thanks 

User-added image
 
<apex:page standardController="Product_Brief__c" extensions="DispatcherContactNewController">
    <apex:pageBlock >
        <apex:pageBlockTable value="{!pbs}" var="p">
            <tr class="lnkdsble" ><apex:column value="{!p.Name}"/></tr>
            <apex:column value="{!p.RecordTypeId}"/>
            <apex:column value="{!p.Createddate}"/>
            </apex:pageBlockTable> 
        </apex:pageBlock>

        <apex:panelGrid columns="4">
            <apex:commandLink action="{!first}">First</apex:commandlink>
            <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandlink>
            <apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink>
            <apex:commandLink action="{!last}">Last</apex:commandlink>
        </apex:panelGrid>
     </apex:pageBlock>
   </apex:form>
</apex:page>

Extension
 
public class DispatcherContactNewController {

        public DispatcherContactNewController(ApexPages.StandardController controller) {
            this.controller = controller;
        }

        public ApexPages.StandardSetController setpb {
            get{
                if (setpb == null) {
                    setpb = new ApexPages.StandardSetController(Database.getQueryLocator(
                        [SELECT Id, Name, RecordTypeId, Createddate FROM Product_Brief__c])
                                                               );
                }
                return setpb;
            }
            set;
        }

        public List<Product_Brief__c>getpbs() {
            return (List<Product_Brief__c>)setpb.getrecords();
        }

        public Boolean hasNext {
            get {
                return setpb.getHasNext();
            }
            set;
        }

        public Boolean hasPrevious {
            get {
                return setpb.getHasPrevious();
            }
            set;
        }

        public Integer pageNumber {
            get {
                return setpb.getPageNumber();
            }
            set;
        }

        public void first() {
            setpb.first();
        }

        public void last() {
            setpb.last();
        }


        public void previous() {
            setpb.previous();
        }


        public void next() {
            setpb.next();
        }
    }

 
we want to get the source IP field from login history object. We do not know how to get it. We can get the IP but the system randomly chooses a one. Does anybody have any idea? thanks

trigger ProductBriefHistory on Product_Brief__c (after update) { List trackedFields = SObjectType.Product_Brief__c.FieldSets.PBHistoryTracking.getFields(); if (trackedFields.isEmpty()) return;

LoginHistory src = [SELECT SourceIp from LoginHistory WHERE UserId =:UserInfo.getUserId() Limit 1];

List fieldChanges = new List();

List apiNameList = new List();

if(Trigger.isUpdate){ for (Product_Brief__c aNew : trigger.new) {

Product_Brief__c aOld = trigger.oldmap.get(aNew.Id);

for (Schema.FieldSetMember fsm : trackedFields) {

String fieldName = fsm.getFieldPath(); String fieldLabel = fsm.getLabel();

if (aNew.get(fieldName) != aOld.get(fieldName)) {

String oldValue = String.valueOf(aOld.get(fieldName)); String newValue = String.valueOf(aNew.get(fieldName)); if (oldValue != null && oldValue.length()>255) oldValue = oldValue.substring(0,255); if (newValue != null && newValue.length()>255) newValue = newValue.substring(0,255);

Product_Brief_History__c aht = new Product_Brief_History__c(); aht.Product_Brief__c = aNew.Id; aht.name__c = fieldLabel; aht.apiName__c = fieldName;

aht.Updated_By__c = UserInfo.getUserId(); aht.OldValue__c = oldValue; aht.NewValue__c = newValue; aht.Source_IP__c = src.SourceIp;

apiNameList.add(aht.apiName__c); fieldChanges.add(aht); }
} } } if (!fieldChanges.isEmpty()) { insert fieldChanges; }

}
I want to create a trigger when user make changes to record, then I want record their current IP. Does anybody know how that works?

Thanks
 <apex:pageBlockSection title="Section 6: " columns="2"  >
                <apex:inputField value="{!Product_Brief__c.System_Size_SUB_2013__c}" />
                <apex:inputField value="{!Product_Brief__c.Quantity_SUB_2013__c}" />
                <apex:inputField value="{!Product_Brief__c.Stainless_Steel_Type__c}" />
                <apex:inputField value="{!Product_Brief__c.Electrical_Cabinet_Placement__c}" />
                <apex:inputField value="{!Product_Brief__c.RTD_Connection_SUF__c}" />
                <apex:inputField value="{!Product_Brief__c.Loadcell_Kits__c}" />
                <apex:inputField value="{!Product_Brief__c.Display__c}" />
                <apex:inputField value="{!Product_Brief__c.Cable_Management_Tree_SUF__c}"/> -->
</apex:pageBlockSection>

My customize visual page I already have 10 pick list value. Cable_Management_Tree_SUF__c this input picklist have 3 values. Can anybody please tell me how insert this input field in my page. 

Thanks
VF page 
<apex:form id="theForm">
<apex:pageBlock id="thePageBlock">
 <apex:inputField value="{!Product_Brief__c.Product_Format__c}" onchange="myPicklistChanged();" id="myPicklist"/>

<table id="table_section4" align="center">
                <tr>
                    <th>QUANTITY</th>
                    <th>UNIT SIZE FILL VOLUME</th> 
                    <th class="Hidecolumn">LIQUID PACKAGING</th>
                    <th>POWDER AGT PACKAGING</th>
                    <th>TOTAL VOLUME:</th>
                </tr>
                <tr>
                    <td><apex:inputField value="{!Product_Brief__c.Quantity1_1__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_1__c}"/></td> 
                    <td class="Hidecolumn"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_1__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_1__c}" /></td>
                    <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_1__c}"/></td> 
                </tr>
                <tr>
                    <td><apex:inputField value="{!Product_Brief__c.Quantity1_2__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_2__c}"/></td> 
                    <td class="Hidecolumn"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_2__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_2__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_2__c}"/></td>
                </tr>
                <tr>
                    <td><apex:inputField value="{!Product_Brief__c.Quantity1_3__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_3__c}"/></td> 
                    <td class="Hidecolumn"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_3__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_3__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_3__c}"/></td>
                </tr>
                <tr>
                    <td><apex:inputField value="{!Product_Brief__c.Quantity1_4__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Unit_Size_Fill_Volume1_4__c}"/></td> 
                    <td class="Hidecolumn"><apex:inputField value="{!Product_Brief__c.Liquid_Packaging1_4__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Powder_AGT_Packaging1_4__c}"/></td>
                    <td><apex:inputField value="{!Product_Brief__c.Total_Volume1_4__c}"/></td>
                </tr>
     <apex:pageBlock >
</apex:form>

JavaScript 

function myPicklistChanged(){
        var myPicklistElement = document.getElementById('{!$Component.theForm.thePageBlock.thePageBlockSection.myPicklist}');
        var myPicklistValue = myPicklistElement.options[myPicklistElement.selectedIndex].value;

        if (myPicklistValue == 'Biochemical Repack' || myPicklistValue == 'AO Powder' || myPicklistValue == 'AGT™ (Advanced Granulation)'  ){
            document.getElementByClassName("Hidecolumn").style.visibility = "hidden";
            
            }
        }

When User Select those value from pic list I want to hide the rows (Class = HideColumn). but it wont work. any body have any idea why? 
User-added image
I have a pick list called System Size(System_Size_SUB_2013__c). When I select 2000L SUB from pick list, I want to give an alert to the user. (Only for a 2000L SUB, Not all of them). Any idea how to do that? Thanks

Field
<apex:inputField value="{!Product_Brief__c.System_Size_SUB_2013__c}" required="true"/>

 
I found a code for sending email from apex. The problem is it have a part i do not want. If i remove below part it wont work. Any idea how to remove below part (div Id= "Remove Part"). Thanks 

VF Page 
<div Id= "Remove Part">
<apex:pageBlock title="Send an Email to Your {!account.name} Representatives">
    <p>Fill out the fields below to test how you might send an email to a user.</p><br />
        <apex:dataTable value="{!account.AccountTeamMembers}" var="contact" border="1">
            <apex:column ><apex:facet name="header">Name</apex:facet>{!contact.user.Name}</apex:column>
            <apex:column ><apex:facet name="header">Email</apex:facet>{!contact.user.Email}</apex:column>
        </apex:dataTable>
</div>
        <apex:commandButton value="Send Email" action="{!send}" /> 
</apex:pageBlock>

Extension 
public class gibco {
    
    public Product_Brief__c pb {get;set;}
    public User u {get;set;}
    
    private ApexPages.StandardController controller {get;set;}
    public boolean bUpdate {get;set;}
    public string loggedinUserId = UserInfo.getUserId();
    public User u2 = [Select ContactId From User where Id =: '005R0000001Y6h4'];
    
    public String ctId{
        get {
             ctId = u2.ContactId;
             return ctId;
            }
        set;
    }
         
    Contact ct = [SELECT AccountId, Name FROM Contact WHERE id=:ctId];
    Account acname = [SELECT Name FROM Account WHERE id=:ct.AccountId];
    public string getacct(){
        Account acct = [SELECT Name FROM Account WHERE id=:ct.AccountId];  
        return acct.Name;
        return null;
        }
         
    Opportunity opp = [SELECT Id FROM Opportunity WHERE AccountId=:ct.AccountId LIMIT 1];
    
 /* ********************* Email ************************* */
    public String subject { get; set; }
    public String body { get; set; }
    private Account account;

    public Account getAccount() {
    account = [select Name, (SELECT user.Name, user.email from AccountTeamMembers) 
                from Account where id = :ct.AccountId];
        return account;
    }

    public PageReference send() {
        // Define the email
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
         
        
    String addresses;
    if (account.AccountTeamMembers[0].user.Email != null)
    {
        addresses = account.AccountTeamMembers[0].user.Email;
        // Loop through the whole list of contacts and their emails
        for (Integer i = 1; i < account.AccountTeamMembers.size(); i++) 
        {
            if (account.AccountTeamMembers[i].user.Email != null)
            {
                addresses += ':' + account.AccountTeamMembers[i].user.Email;
            }
        }
    }

        String[] toAddresses = addresses.split(':', 0);

        // Sets the paramaters of the email
        email.setSubject( 'New Media/Buffer Product Brief from '  + ct.Name + ' at ' + acname.Name);
        email.setToAddresses( toAddresses );
        String htmlBody= 'Dear ' + ct.Name + ':<br/><br/>';
                htmlBody += 'This is a reminder that your review of ' + ct.Name + ' for the position of ' + 
                    ct.Name + ' has not been completed yet. Please complete this review as soon as possible.' +
                    '<br/><br/>Review Link: <a href=https://cs2.salesforce.com/' + ApexPages.currentPage().getParameters().get('id') + '>click here</a><br/><br/>Thank You,<br/>Recruiting Dept.';
                email.setHtmlBody(htmlBody);
    
        // Sends the email
        Messaging.SendEmailResult [] r = 
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); 
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Confirm,'The Product Breif has been submitted successfully. Thank you'));
        return null;
    }

 
HI, I have a Auto number field ({!Product_Brief__c.Name}). It will generate number after saving the page. If i put this field in my page before saving it will break my page. So i want show this output text field after saving, but i could not use rerendering option. Coz I already used it for editing the page. If i combine with it, it will not work is there any way i can do this. Thanks. 
<apex:page standardController="Product_Brief__c" sidebar="true" showHeader="true" extensions="gibco">
<apex:form id="theForm">
<apex:pageBlock id="myPanel">
<apex:pageBlockSection collapsible="false" title="Section 1: Custom Media Information (Required)" id="thePageBlockSection">
              
     <apex:outputText value="{!Product_Brief__c.Name}"></apex:outputText>
               
    <apex:inputField value="{!Product_Brief__c.Opportunity__r.Account.Name}" rendered="{!bEditMode}"/>
    <apex:outputField value="{!Product_Brief__c.Opportunity__r.Account.Name}" rendered="{!NOT(bEditMode)}"/>
    <apex:inputField value="{!Product_Brief__c.Customer_Number__c}" rendered="{!bEditMode}"/>
    <apex:outputField value="{!Product_Brief__c.Customer_Number__c}" rendered="{!NOT(bEditMode)}"/>
    <apex:inputField value="{!Product_Brief__c.Billing_Address__c}" rendered="{!bEditMode}"/>
    <apex:outputField value="{!Product_Brief__c.Billing_Address__c}" rendered="{!NOT(bEditMode)}"/>
    <apex:outputField value="{!Product_Brief__c.CreatedBy.Name}" rendered="{!NOT(bEditMode)}"/>
    <apex:inputField value="{!Product_Brief__c.Shipping_Address__c}" rendered="{!bEditMode}"/>
    <apex:outputField value="{!Product_Brief__c.Shipping_Address__c}" rendered="{!NOT(bEditMode)}"/></apex:pageBlockSection>

<apex:pageblockButtons >
   <apex:commandButton action="{!doToggleEditMode}" value="Edit" reRender="myPanel" rendered="{!NOT(bEditMode)}"/>
   <apex:commandButton action="{!doSave}" value="Save" reRender="myPanel" rendered="{!bEditMode}"/>
   <apex:commandButton value="Save" action="{!save}" id="c2" rendered="{!NOT(bEditMode)}"/>
   <apex:commandButton value="Print" onclick="window.print();" rendered="{!NOT(bEditMode)}"/>
   <apex:commandButton value="Cancel" action="{!Cancel}" rendered="{!NOT(bEditMode)}"/>
</apex:pageblockButtons>

Extention

public class gibco {
    
    public Product_Brief__c pb {get;set;}
    public User u {get;set;}
    
    private ApexPages.StandardController controller {get;set;}
    public boolean bUpdate {get;set;}
    public string loggedinUserId = UserInfo.getUserId();
    public User u2 = [Select ContactId From User where Id =: '005R0000001Y6h4'];
    
    public String ctId{
        get {
         //   if (ctId==null){
         //   if (bUpdate){
                  ctId = u2.ContactId;
         //       }
              return ctId;
         //   }
        }
        set;
    }
         
    Contact ct = [SELECT AccountId FROM Contact WHERE id=:ctId];
    public string getacct(){
        Account acct = [SELECT Name FROM Account WHERE id=:ct.AccountId];  
        return acct.Name;
        return null;
        }
         
    Opportunity opp = [SELECT Id FROM Opportunity WHERE AccountId=:ct.AccountId LIMIT 1];
    
/* *************** Edit Sec. ************************     */ 
    public Boolean bEditMode {
    get {
      if(bEditMode == null) {
          bEditmode = false;
          }
          return bEditMode;
      }
      set;
    }

    public PageReference doToggleEditMode() {
         bEditMode = !bEditMode;
            return null;
    }
    
    public PageReference doSave() {
        try {
        // Do your stuff to save your record
        controller.save();
        doToggleEditMode();
        }
        catch(Exception ex) {
        // Handle error
        }
    
        return null;
        }


Thanks
I have two pages with same fields. One page with input fields (Apex/page1), and the other one with output fields (Apex/page2). Any idea how to save and redirect to the page 2 with all values? 
 
User-added image
How do I add Page# of Total Page# in VF custom page? I only able to get Page#, I could not get the other part ( Of Total Page). Any Idea. Thanks 
 
<apex:panelGrid columns="9">
                <div id="panel">
                    <apex:commandLink action="{!first}">First</apex:commandlink>
                    <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandlink>
                    <apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink>
                    <apex:commandLink action="{!last}">Last</apex:commandlink> 
                    <apex:outputText value="Page #{!pageNumber}"/>
                    <b>Record :</b>
                    <apex:outputText rendered="{!(setpb.pageNumber * setpb.pageSize) < setpb.ResultSize}" value="{!setpb.pageNumber * setpb.pageSize} OF {!setpb.ResultSize}"></apex:outputText>
                    <apex:outputText rendered="{!(setpb.pageNumber * setpb.pageSize) >= setpb.ResultSize}" value="{!setpb.ResultSize} OF {!setpb.ResultSize}"></apex:outputText>
                  
                </div>
            </apex:panelGrid>
Extension 
 
public class DispatcherContactNewController {

    public DispatcherContactNewController(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    private integer offset; // Keeps track of the offset     
    private integer pageSize;   // Page size or number of rows           
    public integer totalRecords;  // Total number of records  
    
    public ApexPages.StandardSetController setpb{
        get{
            if(setpb == null){
                setpb = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT Id, Name, RecordTypeId, Createddate FROM Product_Brief__c ORDER BY Createddate DESC ]));
                         setpb.setPageSize(10);
                         }
                         return setpb;
           } 
        set;
        
    }
    
    public List<Product_Brief__c>getpbs(){
        return (List<Product_Brief__c>)setpb.getrecords();
    }
    
    public Boolean hasNext {
        get {
            return setpb.getHasNext();
            }
        set;
    }
    
    public Boolean hasPrevious {
        get {
            return setpb.getHasPrevious();
            }
        set;
    }
    
    public Integer pageNumber {
        get {
            return setpb.getPageNumber();
            }
        set;
    }
    
    public void first() {
         setpb.first();
    }
     
    public void last() {
         setpb.last();
    }

    // returns the previous page of records
    public void previous() {
        setpb.previous();
    }

    // returns the next page of records
    public void next() {
        setpb.next();
    }
}




 
User-added image
I figure it out when I click on the PB-005426 ({!p.Id}), to redirect to a new VF page layout (gibco2) with all vlues. But I have 5 different record type and VF pages. When user click on product brief number ({!p.Id}), I want to direct them to the right page. For Ex.

Record Type (RecordTypeId) = Media and Buffers then direct them to ('/apex/gibcopb2')
Record Type (RecordTypeId) = Hardware - S.U.B.then direct them to ('/apex/sum1')
Record Type (RecordTypeId) = BPC then direct them to ('/apex/page1')

In below code it only goes to one page('/apex/gibco2). I search for a example and could not find anything suitable for me. Most of them are confusing, and any idea how to assign multiple page according record type ID? Thanks.
<apex:page standardController="Product_Brief__c" extensions="DispatcherContactNewController">
</apex:pageBlock>
    </apex:form>
        <apex:pageBlock title="Recent Product Briefs">
            <apex:pageBlockTable value="{!pbs}" var="p" >
                <apex:column >
                    <apex:commandLink action="{! assetClicked}" value="{!P.Name}" id="theCommandLink"> 
                    <apex:param value="{!P.Id}" name="{!P.Id}" assignTo="{!selectedAsset}" ></apex:param>
                    </apex:commandLink>
                 </apex:column>
                 <apex:column value="{!p.RecordTypeId}"/>
            </apex:pageBlockTable> 
        </apex:pageBlock
    </apex:form>
</apex:pageBlock>

Extension
 
public class DispatcherContactNewController {

    public DispatcherContactNewController(ApexPages.StandardController controller) {
                this.controller = controller;
            }

    public ApexPages.StandardSetController setpb{
            get{
                if(setpb == null){
                    setpb = new ApexPages.StandardSetController(Database.getQueryLocator(
                        [SELECT Id, Name, RecordTypeId, Createddate FROM Product_Brief__c ORDER BY Createddate DESC ]));
                             setpb.setPageSize(10);
                             }
                             return setpb;
               } 
               set;
        }

        public List<Product_Brief__c>getpbs(){
            return (List<Product_Brief__c>)setpb.getrecords();
        }
/* ---------- For Redirect to New Page ------ */
 public string selectedAsset {get;set;}
    public PageReference assetClicked() 
    { 

    PageReference redirect = new PageReference('/apex/gibcopb2'); 

    // pass the selected asset ID to the new page
    redirect.getParameters().put('id',selectedAsset); 
    redirect.setRedirect(true); 

    return redirect;
    }
        }

 
I want to hide my save button (id="c2") when some one click one the edit button. i tried using j query, but it does not work. Does anybody have any idea? Thanks
 
<apex:pageblockButtons >
    <apex:commandButton action="{!doToggleEditMode}" value="Edit" reRender="myPanel" rendered="{!NOT(bEditMode)}" id="c1" />
    <apex:commandButton action="{!doSave}" value="Save" reRender="myPanel" rendered="{!bEditMode}" />
    <apex:commandButton value="PRINT" onclick="window.print();"/>
    <apex:commandButton value="Cancel" action="{!Cancel}"/>
    <apex:commandButton value="Save" action="{!save}" id="c2"/>
</apex:pageblockButtons>

Extension
 
public Boolean bEditMode {
get {
  if(bEditMode == null) {
      bEditmode = false;
      }
      return bEditMode;
  }
  set;
}

public PageReference doToggleEditMode() {
     bEditMode = !bEditMode;
        return null;
}

public PageReference doSave() {
    try {
    controller.save();
    doToggleEditMode();
    }
    catch(Exception ex) {
    }

    return null;
}

 
I have custom page, and when i try to save it my page does not save any information. I used different type of codes for saving. Most of them does not work and some of them break my page. Is there anything wrong with my code that i could not find? ( My main problem is it should save information and return to the same page with values) Any idea? Thanks
 
public class test1 {

    public Product_Brief__c pb {get;set;}
    public User u {get;set;}

    private ApexPages.StandardController controller {get;set;}
    public boolean bUpdate {get;set;}
    public string loggedinUserId = UserInfo.getUserId();
    public User u2 = [Select ContactId From User where Id =: '005R0000001Y6h4'];

    public String ctId{
        get {
                ctId = u2.ContactId;
                return ctId;
            }
        set;
    }

    Contact ct = [SELECT AccountId FROM Contact WHERE id=:ctId];
    public string getacct(){
        Account acct = [SELECT Name FROM Account WHERE id=:ct.AccountId];  
        return acct.Name;
        return null;
        }

    Opportunity opp = [SELECT Id FROM Opportunity WHERE AccountId=:ct.AccountId LIMIT 1];

   /* public PageReference save() {
        controller.save();{
        pageReference pg = new pageReference('/apex/pitu3');
        pg.setRedirect(true);
        pg .getParameters().put('id',controller.getId());
        return pg;
        }
        return null;
    } */

    /* public PageReference save() {
       controller.save(); 
       return null;
    }  */


   /* public PageReference save() {
    if(controller.save() != null) { 
    PageReference ref = Page.sumpage3; 
    ref.setRedirect(true); 
    return ref; 
    }
     return null;
    } */


    public PageReference save() {
        if(controller.save() != null) {
        PageReference congratsPage = Page.pitu3;
        congratsPage.setRedirect(true);
        congratsPage.getParameters().put('id',controller.getId());
        return congratsPage;
        }return null;
    }

    public test1(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    public PageReference page1(){
    return Page.pitu1;
    }

    public PageReference page2(){
    return Page.pitu2;
    }

    public PageReference page3(){
    return Page.pitu3;
    }

    public PageReference page4(){  
    return Page.pitu4;
    }

    public PageReference page5(){
    return Page.pitu5;
    }

}

 
I want to create a trigger when user make changes to record, then I want record their current IP. Does anybody know how that works?

Thanks
 <apex:pageBlockSection title="Section 6: " columns="2"  >
                <apex:inputField value="{!Product_Brief__c.System_Size_SUB_2013__c}" />
                <apex:inputField value="{!Product_Brief__c.Quantity_SUB_2013__c}" />
                <apex:inputField value="{!Product_Brief__c.Stainless_Steel_Type__c}" />
                <apex:inputField value="{!Product_Brief__c.Electrical_Cabinet_Placement__c}" />
                <apex:inputField value="{!Product_Brief__c.RTD_Connection_SUF__c}" />
                <apex:inputField value="{!Product_Brief__c.Loadcell_Kits__c}" />
                <apex:inputField value="{!Product_Brief__c.Display__c}" />
                <apex:inputField value="{!Product_Brief__c.Cable_Management_Tree_SUF__c}"/> -->
</apex:pageBlockSection>

My customize visual page I already have 10 pick list value. Cable_Management_Tree_SUF__c this input picklist have 3 values. Can anybody please tell me how insert this input field in my page. 

Thanks