You need to sign in to do that
Don't have an account?
Ian Lin 439
In My action support function my method which is in controller is not getting called?can somebody help
vf page:
<apex:page standardController="order" extensions="OrderExtension">
<apex:form >
<apex:messages />
<apex:pageBlock title="New Order">
<apex:pageBlockSection title="Order Details" collapsible="false">
<apex:inputField value="{!Order.AccountId}" html-placeholder="Customer Name"/>
<apex:inputField value="{!Order.Email__c}" html-placeholder="Enter Text"/>
<apex:inputField value="{!Order.Phone__c}" html-placeholder="Enter Text"/>
<apex:inputField value="{!Order.EffectiveDate}" html-placeholder="Enter Text"/>
<apex:inputField value="{!Order.Status}"/>
<apex:inputField value="{!Order.ContractId}" html-placeholder="Contract Id"/>
<apex:inputField value="{!Order.AEG__Rep_Code__c}"/>
<!--apex:inputField value="{!Order.AEG__AR_Terms__c}"/-->
<!--apex:inputField value="{!Order.AEG__Ship_Via__c}"/-->
<apex:inputField value="{!Order.Pricebook2Id}" html-placeholder="PriceBook Type"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Address">
<apex:inputField value="{!Order.ShippingAddress__c}" style="width:800px;height:20px" html-placeholder="Enter Text"/><br/>
<apex:inputField value="{!Order.BillingAddress__c}" style="width:800px;height:20px" html-placeholder="Enter Text"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<div align="right">
<apex:commandButton value="Add New Order Item" action="{!add}"/>
</div>
</apex:pageBlockSection>
<apex:pageBlockSection title="Order Details">
<apex:pageBlockTable value="{!orderList}" var="o">
<apex:column headerValue="Product Name" width="50%">
<apex:outputField value="{!o.Product2Id}"/>
</apex:column>
<apex:column headerValue="Product Family" width="50%">
<apex:outputField value="{!o.product2.Family}"/>
</apex:column>
<apex:column headerValue="Ordered Quantity" width="50%" >
<apex:inputField value="{!o.Quantity}"/>
</apex:column>
<!--apex:column headerValue="Available Quantity" width="50%">
<apex:outputField value="{!o.AvailableQuantity__c}"/>
</apex:column-->
<apex:column headerValue="List Price" width="50%">
<apex:outputField value="{!o.ListPrice}"/>
</apex:column>
<apex:column headerValue="Unit Price" width="50%">
<apex:outputField value="{!o.UnitPrice}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Action</apex:facet>
<apex:commandLink action="{!deleteRecord}" value="Delete" onclick="if(!confirm('Are you sure?')) return false;">
<apex:param name="rowId" assignTo="{!bkId}" value="{!o.Id}"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:pageBlock id="orderAdd" >
<apex:pageblockSection >
<apex:pageBlockTable value="{!OrderLi}" var="orders" id="pbt">
<!--apex:column headerValue="Product Name">
<apex:inputField value="{!orders.Product2Id}">
</apex:inputField>
</apex:column-->
<apex:column headerValue="Product Name">
<apex:inputField value="{!orders.Product2Id}">
<apex:actionSupport event="onchange" action="{!autopop}">
<apex:param name="selectedR" value="{!orders.Product2Id}" assignTo="{!ordId}"/>
</apex:actionSupport>
</apex:inputField>
</apex:column>
<apex:column headerValue="Product Family">
<apex:inputField value="{!orders.product2.Family}"/>
</apex:column>
<!--apex:outputField value="{!orders.product2.Family}"/-->
<apex:column headerValue="order Quantity">
<apex:inputField value="{!orders.Quantity}"/>
</apex:column>
<!--apex:column headerValue="Available Quantity" width="50%">
<apex:outputField value="{!orders.AvailableQuantity__c}"/>
</apex:column-->
<apex:column headerValue="order ListPrice">
<apex:inputField value="{!orders.ListPrice}"/>
</apex:column>
<apex:column headerValue="orders UnitPrice">
<apex:inputField value="{!orders.UnitPrice}"/>
</apex:column>
<!--apex:column headerValue="orders Pricebook">
<apex:inputField value="{!Order.Pricebook2Id}"/>
</apex:column-->
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageBlock>
<apex:pageBlockSection >
<apex:panelGrid columns="4">
<apex:commandButton action="{!First}" value="First"/>
<apex:commandButton action="{!Previous}" value="Previous"/>
<apex:commandButton action="{!Next}" value="Next"/>
<apex:commandButton action="{!Last}" value="Last"/>
</apex:panelGrid>
</apex:pageBlockSection>
<apex:pageBlockSection >
<div align="centre">
<apex:panelGrid columns="2" >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:panelGrid>
</div>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
extension method:
public PageReference autopop(){
// order cont=(order) sc.getRecord();
//system.debug(cont);
//cont.order=[select product2.family from orderitem where id=:cont.Product2Id];
ordId = apexpages.currentPage().getParameters().get('selectedR');
system.debug(ordId);
system.debug('rishi');
//OrderItem ord = [select product2.family from orderItem where id =: ordId limit 1];
//system.debug(ordId);
return null;
}
<apex:page standardController="order" extensions="OrderExtension">
<apex:form >
<apex:messages />
<apex:pageBlock title="New Order">
<apex:pageBlockSection title="Order Details" collapsible="false">
<apex:inputField value="{!Order.AccountId}" html-placeholder="Customer Name"/>
<apex:inputField value="{!Order.Email__c}" html-placeholder="Enter Text"/>
<apex:inputField value="{!Order.Phone__c}" html-placeholder="Enter Text"/>
<apex:inputField value="{!Order.EffectiveDate}" html-placeholder="Enter Text"/>
<apex:inputField value="{!Order.Status}"/>
<apex:inputField value="{!Order.ContractId}" html-placeholder="Contract Id"/>
<apex:inputField value="{!Order.AEG__Rep_Code__c}"/>
<!--apex:inputField value="{!Order.AEG__AR_Terms__c}"/-->
<!--apex:inputField value="{!Order.AEG__Ship_Via__c}"/-->
<apex:inputField value="{!Order.Pricebook2Id}" html-placeholder="PriceBook Type"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Address">
<apex:inputField value="{!Order.ShippingAddress__c}" style="width:800px;height:20px" html-placeholder="Enter Text"/><br/>
<apex:inputField value="{!Order.BillingAddress__c}" style="width:800px;height:20px" html-placeholder="Enter Text"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<div align="right">
<apex:commandButton value="Add New Order Item" action="{!add}"/>
</div>
</apex:pageBlockSection>
<apex:pageBlockSection title="Order Details">
<apex:pageBlockTable value="{!orderList}" var="o">
<apex:column headerValue="Product Name" width="50%">
<apex:outputField value="{!o.Product2Id}"/>
</apex:column>
<apex:column headerValue="Product Family" width="50%">
<apex:outputField value="{!o.product2.Family}"/>
</apex:column>
<apex:column headerValue="Ordered Quantity" width="50%" >
<apex:inputField value="{!o.Quantity}"/>
</apex:column>
<!--apex:column headerValue="Available Quantity" width="50%">
<apex:outputField value="{!o.AvailableQuantity__c}"/>
</apex:column-->
<apex:column headerValue="List Price" width="50%">
<apex:outputField value="{!o.ListPrice}"/>
</apex:column>
<apex:column headerValue="Unit Price" width="50%">
<apex:outputField value="{!o.UnitPrice}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Action</apex:facet>
<apex:commandLink action="{!deleteRecord}" value="Delete" onclick="if(!confirm('Are you sure?')) return false;">
<apex:param name="rowId" assignTo="{!bkId}" value="{!o.Id}"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:pageBlock id="orderAdd" >
<apex:pageblockSection >
<apex:pageBlockTable value="{!OrderLi}" var="orders" id="pbt">
<!--apex:column headerValue="Product Name">
<apex:inputField value="{!orders.Product2Id}">
</apex:inputField>
</apex:column-->
<apex:column headerValue="Product Name">
<apex:inputField value="{!orders.Product2Id}">
<apex:actionSupport event="onchange" action="{!autopop}">
<apex:param name="selectedR" value="{!orders.Product2Id}" assignTo="{!ordId}"/>
</apex:actionSupport>
</apex:inputField>
</apex:column>
<apex:column headerValue="Product Family">
<apex:inputField value="{!orders.product2.Family}"/>
</apex:column>
<!--apex:outputField value="{!orders.product2.Family}"/-->
<apex:column headerValue="order Quantity">
<apex:inputField value="{!orders.Quantity}"/>
</apex:column>
<!--apex:column headerValue="Available Quantity" width="50%">
<apex:outputField value="{!orders.AvailableQuantity__c}"/>
</apex:column-->
<apex:column headerValue="order ListPrice">
<apex:inputField value="{!orders.ListPrice}"/>
</apex:column>
<apex:column headerValue="orders UnitPrice">
<apex:inputField value="{!orders.UnitPrice}"/>
</apex:column>
<!--apex:column headerValue="orders Pricebook">
<apex:inputField value="{!Order.Pricebook2Id}"/>
</apex:column-->
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageBlock>
<apex:pageBlockSection >
<apex:panelGrid columns="4">
<apex:commandButton action="{!First}" value="First"/>
<apex:commandButton action="{!Previous}" value="Previous"/>
<apex:commandButton action="{!Next}" value="Next"/>
<apex:commandButton action="{!Last}" value="Last"/>
</apex:panelGrid>
</apex:pageBlockSection>
<apex:pageBlockSection >
<div align="centre">
<apex:panelGrid columns="2" >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:panelGrid>
</div>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
extension method:
public PageReference autopop(){
// order cont=(order) sc.getRecord();
//system.debug(cont);
//cont.order=[select product2.family from orderitem where id=:cont.Product2Id];
ordId = apexpages.currentPage().getParameters().get('selectedR');
system.debug(ordId);
system.debug('rishi');
//OrderItem ord = [select product2.family from orderItem where id =: ordId limit 1];
//system.debug(ordId);
return null;
}
Anudeep (Salesforce Developers)
A similar issue is discussed in this post. I recommend narrowing this down by simplifying your code, also try adding the reRender attribute
Ian Lin 439
How to use reRender in above code?please help with that