This is what I'm trying to accomplish with my VisualForce Page. I would have three input Text sections on my Visual Force page. User would enter an integer that would be the Discount that would be applied to the Total Price.
On the side, I want to show a running total so to speak of what happens to a total price once you enter the inputs for the Discounts. This is what I have so far.
<apex:page standardController="QuoteLineItem" extensions="qliUpdate" recordSetVar="QuoteLineItems" showHeader="true" id="muquote" >
<apex:form id='SWH'>
<apex:pageBlock id='JFY'>
<apex:pageBlockSection columns="2">
<apex:outputLabel value="Product Discount" for="ProductId"/>
<apex:inputText id="ProductID" value="{!Ndisc}" onblur="DisplayRunningTotal('{!$Component.TotalProductId}');"/>
<apex:outputLabel value="Support Discount" for="ProductId"/>
<apex:inputText id="SupportID" value="{!Sdisc}" onblur="DisplayRunningTotal('{!$Component.TotalProductId}');"/>
<apex:outputLabel value="Additional Discount" for="ProductId"/>
<apex:inputText id="AdditionalID" value="{!AddtnlDisc}" onblur="DisplayRunningTotal('{!$Component.TotalProductId}');" />
</apex:pageBlockSection>
<apex:pageBlockSection id='WIH'>
<apex:outputLabel value="TotalProductValue" id="TotalProductId"/>
<apex:outputLabel value="TotalSupportValue" id="TotalSupportId"/>
</apex:pageBlockSection>
</apex:pageBlock>>
</apex:form>
<script>
function DisplayRunningTotal(xyz){
var myOutputLabel = document.getElementById('muquote:SWH:JFY:WIH:TotalSupportId');
myOutputLabel.innerHTML='jhsdfsdfjksdnkf';
}
</script>
</apex:page>
The problem right now is the Javascript. I've found a way to modify the Value of the TotalSuportID which is what I want.
This TotalSupportID's value will then eventually change to reflect the changes in the price that happens when you enter values for the Discount input texts above.
However, I have to enter the ID's of all the previous stages that came before the TotalSupportID's ID(my price value) in order to change the value.
i.e. var myOutputLabel = document.getElementById('muquote:SWH:JFY:WIH:TotalSupportId');
This is obviously a problem since if I scale up the VisualForce with more sections, I'll have to keep going back manually to enter in any new ID's that occur before TotalSupportID's section. Is there a way of making this more dynamic?
Thanks! Let me know if any more clarification is needed.