You need to sign in to do that
Don't have an account?
finalist
Formatting numeric s-controls
I have an s-control that calculates a fee based on whether a [x] checkbox is checked, and the default formatting displays the result with 3-decimal precision. It also displays in a larger font than the rest of the page, and with a white background.
I added some css code intended to bring the (Contract) page's stylesheets into play for the font and background, but I really am more interested in the number format for now.
Currently the s-control is displaying the formula directly, i.e. I do not have a javascript function doing the calculation. I tried that, but my only experience with functions inside s-controls is something that requires a link to be clicked, and in this case I want the number to appear without any further action by the client/user.
Here's the code (the js function is there, but it's not being called (as you can see)):
Code:
Any thoughts? Thanks!
I added some css code intended to bring the (Contract) page's stylesheets into play for the font and background, but I really am more interested in the number format for now.
Currently the s-control is displaying the formula directly, i.e. I do not have a javascript function doing the calculation. I tried that, but my only experience with functions inside s-controls is something that requires a link to be clicked, and in this case I want the number to appear without any further action by the client/user.
Here's the code (the js function is there, but it's not being called (as you can see)):
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <link href="/dCSS/Theme2/default/common.css" type="text/css" media="handheld,print,projection,screen,tty,tv" rel="stylesheet" > <link href="/dCSS/Theme2/default/custom.css" type="text/css" media="handheld,print,projection,screen,tty,tv" rel="stylesheet"> <HTML> <!-- HEAD> <script> function resizeframe(){ sframe=top.document.getElementById("NCPD_Fee"); sframe.style.height=document.body.clientHeight + "px"; } function calcNCPDFee(){ // calcNCPDFee calculates 3% * Contract Amount if the NCPD Fee checkbox is checked var ncpd_fee = {!IF(Contract.NCPD_Member__c, (Contract.Amount__c * 0.03), 0)}; ncpd_fee.toFixed(2); } </script> </HEAD --> <BODY class="contract"> <!-- DIV class="bPageBlock secondaryPalette" --> <DIV class="pbBody"> <DIV class="pbSubsection" --> <TABLE class="detailList"> <TR> <TD class="labelCol">
// Here is where the calculation is actually being displayed:
NCPD Fee: {!IF(Contract.NCPD_Member__c, (Contract.Amount__c * 0.03), 0)}
</TD> </TR> </TABLE> </DIV> </DIV> <!-- /DIV --> </BODY> </HTML>
Any thoughts? Thanks!
Maybe I don't understand the usage of your s-control, but wouldn't it be easier to use a custom SFDC calculated field to do this?
- Mike
(I knew I shouldn't have skipped over that part of the tutorial...dang!)
Thanks for being polite about it at least.