You need to sign in to do that
Don't have an account?
Please suggest
In apex controller class , how to take the value (in red color) of vf field which is edited.
vf code:
<apex:page controller="ProductSearchController" sidebar="false" showHeader="false">
<apex:stylesheet value="{!URLFOR($Resource.styles, 'styles.css')}"/>
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!back}" value="Back"/>
<apex:commandButton action="{!order}" value="Place a order"/>
</apex:pageBlockButtons>
<apex:pageMessages />
<apex:pageBlockSection title="You Selected following items" columns="1" collapsible="false">
<apex:pageBlockTable value="{!selectedCategories}" var="c" title="Double click on Quantity to edit it">
<apex:column value="{!c.cat.Name__c}" headerValue="Name"/>
<apex:column value="{!c.cat.Price__c}" headerValue="Total Amount"/>
<apex:column value="{!c.cat.code__c}" headerValue="Code"/>
<apex:column value="{!c.cat.category__c}" headerValue="Category"/>
<apex:column headerValue="Quantity">
<apex:outputField value="{!c.cat.Quantity__c}">
<apex:inlineEditSupport event="ondblclick" showOnEdit="update"/>
</apex:outputField>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<br/>
<apex:commandButton id="update" action="{!saveOrder}" value="Save Order" styleclass="updateButton"/>
</apex:pageBlock>
</apex:form>
</apex:page>
So if your controller has a get set method for the Opportunity you can able to create a new record based off the information that is stored in the VF page.
For example:
Opportunity opp {get;set;}
Public pageRefer Save(){
CustomObject__c cus = new CustomObject__c(
cus.Name = opp.Name,
cus.Quantity__c = opp.Quantity
....
);
Return null;
}
So you want something like that. Let me know if you want something specific.
All Answers
I'm not sure i'm getting it but is your Visualforce page being used for detail and edit page, and you would only like to use the portion in red in the detail page and not edit?
Based on my assumption, you can create an extension and create a variable that identifies the page as an edit page. Here is my an exmple code i create in the past to identify what to show on the page during new vs edit a page
and here is a sample code of my VF Page
let me know if this helps
Actually whatever values are displaying in that vf page are from the custom object(Product) but In that vf page quantity field is editable field so now i nees to save all those fields in another custom object(order).but how to access that edited quantity field from controller class.
So if your controller has a get set method for the Opportunity you can able to create a new record based off the information that is stored in the VF page.
For example:
Opportunity opp {get;set;}
Public pageRefer Save(){
CustomObject__c cus = new CustomObject__c(
cus.Name = opp.Name,
cus.Quantity__c = opp.Quantity
....
);
Return null;
}
So you want something like that. Let me know if you want something specific.