What I'm trying to do: at the onblur event for an inputField, I want to update an outputText based on the contents of that inputField.
Here is my code:
<apex:page standardController="Opportunity" extensions="opptyLineItem_EditAll2" id="page">
<apex:form id="form">
<apex:pageBlock title="{!$ObjectType.Product2.LabelPlural} (Standard {!$ObjectType.PriceBook2.Label})" id="dc" rendered="{!$ObjectType.Opportunity.accessible}">
Change any of these fields and tab out of them to see the calculation take place. Click Save when satisfied.<p/>
<apex:pageBlockTable value="{!Opportunity.OpportunityLineItems}" var="li" id="table">
<apex:column headerValue="Number of Seats">
<apex:inputField value="{!li.quantity}" id="numberOfSeats" >
<apex:actionSupport event="onblur"
action="{!incrementCounter}"
rerender="counter" status="counterStatus">
<apex:param name="numberOfSeats" value="{!li.quantity}" assignTo="{!liQuantity}"/>
</apex:actionSupport>
</apex:inputField>
<apex:facet name="footer" >
<span style="float:right;">Totals:</span>
</apex:facet>
</apex:column>
<apex:column headerValue="Total List Price">
<apex:outputpanel id="counter">
<apex:outputText value="{!count}"/>
</apex:outputpanel>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
And the controller:
public class opptyLineItem_EditAll2 {
public Opportunity oppty {get;set;}
public Double liQuantity {get;set;}
public opptyLineItem_EditAll2(ApexPages.StandardController stdController) { }
Integer count = 0;
public PageReference incrementCounter() {
count++;
return null;
}
public Double getCount() {
System.debug('>>> I am here ' + liQuantity);
//System.debug('>>> Oppty Id: ' + oppty.Id);
return count;
}
}
What works: I see the outputText being updated with the counter.
What doesn't work: I can't seem to get the current quantity and set it in the liQuantity property in the controller, and I can't seem to set the Opportunity object (oppty) in the controller. If I uncomment the second System.debug, I get an NPE.
Help?