You need to sign in to do that
Don't have an account?
Charles McDowell
How to get the value of inputfield in standard controller extension
I am trying to get the value of the parent Record to redirect my child record back to the parent. Parent is Quote__c and Child is QuoteDetail__c. I get a null for qID. Can someone tell me what I am doing wrong?
<apex:page standardController="QuoteDetail__c" extensions="QuoteDetailRecExtension" sidebar="False" >{
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection columns="1">
<apex:outputField value="{!QuoteDetail__c.Product__c}" />
<apex:outputField value="{!QuoteDetail__c.Product_Category__c}" />
<apex:outputField value="{!QuoteDetail__c.Order_In_System__c}" />
<apex:outputField value="{!QuoteDetail__c.Quantity__c}" />
<apex:outputField value="{!QuoteDetail__c.Coverage_Density__c}" />
<apex:outputField value="{!QuoteDetail__c.Product_Total__c}" />
<apex:outputField value="{!QuoteDetail__c.Quote__c}" id="Quote"/>
<apex:outputField value="{!QuoteDetail__c.ID}" rendered="false" />
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:pageBlockTable value="{!qp}" var="q" >
<apex:column headerValue="Product/Size" value="{!q.ProductSizePrice__c}" />
<apex:column value="{!q.Quantity__c}" />
<apex:column value="{!q.List_Price__c}" />
<apex:column value="{!q.Ext__c}" />
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:pageBlockButtons location="Bottom">
<apex:commandButton value="Edit" action="{!Edit}"/ >
<apex:commandButton value="Back" action="{!Back}" >
<apex:param name="Quote" value="{!QuoteDetail__c.Quote__c}" />
</apex:commandButton>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
public class QuoteDetailRecExtension {
Public List<QuotePrice__c> qp {Get;Set;}
Public QuoteDetailRecExtension(Apexpages.StandardController cext) {
String ID = apexpages.currentPage().getParameters().get('id');
qp = [Select ProductSizePrice__c, Quantity__c, List_Price__c, Ext__c
From QuotePrice__c Where QuoteDetail__c = : Id];
}
Public pagereference back(){
// Get the ParentID - QuoteID
String qID = apexpages.currentPage().getparameters().get('Quote');
system.debug('Quote ID = ' + qID);
pagereference ret = page.QuoteDetail;
ret.getParameters().put('ID', qID);
ret.setRedirect(True);
return ret;
}
}
<apex:page standardController="QuoteDetail__c" extensions="QuoteDetailRecExtension" sidebar="False" >{
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection columns="1">
<apex:outputField value="{!QuoteDetail__c.Product__c}" />
<apex:outputField value="{!QuoteDetail__c.Product_Category__c}" />
<apex:outputField value="{!QuoteDetail__c.Order_In_System__c}" />
<apex:outputField value="{!QuoteDetail__c.Quantity__c}" />
<apex:outputField value="{!QuoteDetail__c.Coverage_Density__c}" />
<apex:outputField value="{!QuoteDetail__c.Product_Total__c}" />
<apex:outputField value="{!QuoteDetail__c.Quote__c}" id="Quote"/>
<apex:outputField value="{!QuoteDetail__c.ID}" rendered="false" />
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:pageBlockTable value="{!qp}" var="q" >
<apex:column headerValue="Product/Size" value="{!q.ProductSizePrice__c}" />
<apex:column value="{!q.Quantity__c}" />
<apex:column value="{!q.List_Price__c}" />
<apex:column value="{!q.Ext__c}" />
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:pageBlockButtons location="Bottom">
<apex:commandButton value="Edit" action="{!Edit}"/ >
<apex:commandButton value="Back" action="{!Back}" >
<apex:param name="Quote" value="{!QuoteDetail__c.Quote__c}" />
</apex:commandButton>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
public class QuoteDetailRecExtension {
Public List<QuotePrice__c> qp {Get;Set;}
Public QuoteDetailRecExtension(Apexpages.StandardController cext) {
String ID = apexpages.currentPage().getParameters().get('id');
qp = [Select ProductSizePrice__c, Quantity__c, List_Price__c, Ext__c
From QuotePrice__c Where QuoteDetail__c = : Id];
}
Public pagereference back(){
// Get the ParentID - QuoteID
String qID = apexpages.currentPage().getparameters().get('Quote');
system.debug('Quote ID = ' + qID);
pagereference ret = page.QuoteDetail;
ret.getParameters().put('ID', qID);
ret.setRedirect(True);
return ret;
}
}
get('id') gives me the QuoteDetailID which is the child ID. I need the Quote ID which is the parent
Thansk