0

I have finished the visual force page and the wrapper and now what I wanted to happen is that when a record/s has been Selected then the action page will redirect wherein users will be able to edit the PRICE and add QUANTITY then it will be SAVED to another OBJECT called Sales Product (Sales_Product__c) which is related to Product_Entry__c.

Should I create new visual force page or something? Can someone help me?

Here is the code that I used now.

<apex:page controller="wrapperExample3">
<apex:form >
<apex:pageBlock >
    <apex:pageBlockButtons location="both">
    <apex:commandButton value="Select and Create Sales Product" /> 
 <!-- I have no Action for the Save yet :( -->
    <apex:commandButton value="Cancel" />
    </apex:pageBlockButtons>
    <apex:pageBlockSection >
    <apex:pageBlockTable value="{!lstWrapperString}" var="wrap">
    <apex:column headerValue="Action">
        <apex:inputCheckbox />
    </apex:column>

    <apex:column headerValue="Name">
        {!wrap.Name}
    </apex:column>

    <apex:column headerValue="Price">
         {!wrap.Price}
    </apex:column>
    </apex:pageBlockTable>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

</apex:page>

And here is the code for the wrapper...

public class wrapperExample3 {

    List <Product_Entry__c> ProdList=new List<Product_Entry__c>();
    List <wrapper> lstw =new List<wrapper>();

    public List<wrapper> getlstWrapperString() 
    { 
            ProdList=[select name,Price__c from Product_Entry__c];
            for (Product_Entry__c pe : ProdList)   
            {
                    lstw.add(new wrapper( pe.name, pe.Price__c ) );
            }              
            return lstw;
    }

    public Class wrapper 
    {  
            public string name {get;set;}
            public decimal price {get;set;}
            public wrapper(string Name,decimal Price) 
            {
                    this.Name = Name;
                    this.Price = Price; 
            }

    }
}

Thank you in advance.

  • You can do that in the same VF page and controller – Ajay Prakash Dubey Aug 6 '16 at 7:02
-1

You can do it in 2 ways 1. On selection of value you can rerender you edit section 2. If you want to redirect to other page then pass the values in URL and then read them in the page.

  • I want the 2nd option but its just that I dont have any idea how to do it. Can you make an example? – Carlo Magno Lindo Aug 8 '16 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.