", "upvoteCount": 1, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T3z86SAB", "datePublished": "2017-05-12T23:29:02.000Z", "author": { "@type": "Person", "name": "Nithesh C Nekkanti", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000DD6LGQA1", "affiliation": { "@type": "Organization", "name": "Sonos" } } }, "suggestedAnswer": [ { "@type": "Answer", "text": "@Nithesh - thanks for sharing this, reall great tool. I have slightly modified it to suit our need so have a questions.  Question- how do I round up the results in two decimals? for example  results for number of payments I get = 115.00200000000001 I want to display 115.00 or just 115 Please could you guide me?  Thanks a ton.", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T3z86SAB", "datePublished": "2017-06-02T11:09:24.000Z", "author": { "@type": "Person", "name": "Swapnil Patne", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000CYKy1QAH", "affiliation": { "@type": "Organization", "name": "--" } } } ] } }
Skip to main content
21 answers
  1. May 12, 2017, 11:29 PM
    Try this, you need to add Mortgage formula in the java script

     

    <apex:page showHeader="false" sidebar="false">

    <html>

    <head>

    <meta charset="utf-8" />

    <meta http-equiv="x-ua-compatible" content="ie=edge" />

    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <apex:slds /> <!-- SLDS style sheet -->

    </head>

    <body>

    <div class="slds-scope">

    <div class="slds-page-header">

    <div class="slds-grid">

    <div class="slds-col">

    <h1 class="slds-page-header__title" title="Review"> Mortgage Calculator</h1>

    </div>

    </div>

    </div>

    <br/>

    <div class="slds-p-horizontal--small slds-grid">

    <div class="slds-form--stacked">

    <div class="slds-form-element">

    <label class="slds-form-element__label" for="inputSample2">Loan Amount:</label>

    <div class="slds-form-element__control">

    <input type="text" id="inputSample2" class="slds-input" placeholder="" onchange="calc()" />

    </div>

    </div>

    <div class="slds-form-element">

    <label class="slds-form-element__label" for="inputSample2">APR %</label>

    <div class="slds-form-element__control">

    <input type="text" id="inputSample3" class="slds-input" placeholder="" onchange="calc()" />

    </div>

    </div>

    <div class="slds-form-element">

    <label class="slds-form-element__label" for="inputSample2">Term</label>

    <div class="slds-form-element__control">

    <input type="text" id="inputSample4" class="slds-input" placeholder="" onchange="calc()" />

    </div>

    </div>

    </div>

    </div>

    <br/>

    <div class="slds-tile slds-m-horizontal--small">

    <div class="slds-media__body">

    <div class="slds-tile__detail slds-text-body--small">

    <dl class="slds-list--horizontal slds-wrap">

    <dt class="slds-item--label slds-text-color--weak slds-truncate" title="First Label">Monthly Payment :</dt>

    <dd class="slds-item--detail slds-truncate" id ="MonthlyPayment" ></dd>

    <dt class="slds-item--label slds-text-color--weak slds-truncate" title="Second Label">Number of Payments :</dt>

    <dd class="slds-item--detail slds-truncate" id="NumPayments"></dd>

    <dt class="slds-item--label slds-text-color--weak slds-truncate" title="Second Label">Total Interest :</dt>

    <dd class="slds-item--detail slds-truncate" id="TotalInterest"></dd>

    </dl>

    </div>

    </div>

    </div>

    </div>

    <script>

    function calc() {

    var loanAmount = document.getElementById("inputSample2").value;

    var APR = document.getElementById("inputSample3").value;

    var term = document.getElementById("inputSample4").value;

    document.getElementById("MonthlyPayment").innerHTML = loanAmount*10; //Change it Accordingly

    document.getElementById("NumPayments").innerHTML = term*12; //Change it Accordingly

    document.getElementById("TotalInterest").innerHTML = loanAmount*12; //Change it Accordingly

    }

    </script>

    </body>

    </html>

    </apex:page>

     
0/9000