function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
<apex:page id="page" standardController="Employee__c"> <apex:form id="form"> <apex:pageBlock id="pgblk" mode="edit" title="Employee Edit"> <apex:pageBlockSection id="pgblksec" title="Information" columns="2"> <apex:inputField value="{!Employee__c.Employee_Segment_Ineligible_Under_Plan__c}" onchange="calculatedSubtotal()" id="employeeSIUP" style="width:80%"></apex:inputField> <apex:inputField value="{!Employee__c.Individual_Income_Reported_Via_IRS__c}" onchange="calculatedSubtotal()" id="individualIRVI" style="width:80%"></apex:inputField> <apex:inputField value="{!Employee__c.Calculated_Subtotal__c}" id="calTotal" style="width:80%"></apex:inputField> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script type="text/javascript"> var calculatedSubtotal = function() { $( "[id*='calTotal']" ).attr( "readonly", "true" ); var empSIUPVal = $( "[id*='employeeSIUP']" ).val(); var indvIRVI = $( "[id*='individualIRVI']" ).val(); var total = parseFloat( empSIUPVal ) + parseFloat( indvIRVI ); if( !isNaN( total ) ) { $( "[id*='calTotal']" ).val( total ); } }; calculatedSubtotal(); </script> </apex:page>
You can use JavaScript and jQuery to calculate the sum of the two fields and use the help of onchange method and populate into the third field.
Here is the code: Hope this helps.
Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra