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.

1
  • You can do that in the same VF page and controller Commented Aug 6, 2016 at 7:02

1 Answer 1

-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.

1
  • I want the 2nd option but its just that I dont have any idea how to do it. Can you make an example? Commented Aug 8, 2016 at 23:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .