Using Javascript to calculate monthly payments on form

I have a single page form where I would like to be able to
allow the user to choose between making a one time payment or
monthly payments for a user defined amount. I could easily break
the form into two pages and calculate the value of the monthly
payments and display it on the second page if the user selected the
monthly payment option. What I would like is a single page where
the monthly payment is determined on the fly when either the user
selects the monthly payment radio button or when the user defined
dollar amount is entered.
I think I have the function determined to do the calculation
for the monthly payment but I'm unsure as to how to get cf to read
or display the value. I was trying to use the following with no
luck:
<input type=radio name=Installments value="Yes" tabindex=1
onClick="calculatemonthlypayment(document.forms[0].DonationAmount)">
<script type="text/javascript">
function calculatemonthlypayment(donation)
monthlypayment=(donation/12)
return monthlypayment
</script>
Then trying to output the result like this:
<cfoutput><input type="text" readonly="yes"
value="#dollarformat(monthlypayment)#"></cfoutput>
Any idea what I'm doing wrong or missing? Or is there a much
better way to accomplish this?

> <cfoutput><input type="text" readonly="yes"
value="#dollarformat(monthlypayment)#"></cfoutput>
You cannot do that. CF code is executed on the server
(first). The resulting javascript (html, css, ...) code is then
sent to the browser where it is executed. Since javascript code is
executed in the client browser,
after the CF code is already finished, the variable
"monthlypayment" doesn't exist as far as CF is concerned.
You can use javascript to both read the donation text field
amount and calculate the "monthlypayment" amount to display. Here
is a simple example. You'll need to add validation and number
formatting.

Similar Messages

  • Using Javascript and ScriptUI to create a form that brings in a symbol from library

    Hello everyone,
    I've been trying to pull together the right info to use javascript to create a form to bring in particularsymbols from the symbol library based on the variables taken from the form. I've taken bits and pieces from various sample scripts and tried to make this work, but my problem appears when I try to use conditionals.
    This is a limited version of what I want to do, but it is enough to get the point across.
    1. I want to select a script that has various dropdown boxes. I would like the first dropdown to give me 3 options: 10, 13, 18
    2. I would also like another drop down box that gives me three more options: single needle, double needle, and knife edge.
    3. I would then like it to have an "ok" button and "Cancel" button.
    4. From here when I click the ok button, a symbol is brought in from the library depending on what parameters were given to the form.
    ex. If I selected 10 in the first drop down and double needle in the second, I would like "SYMBOL A" to be pulled from the library and centered on the artboard.
    ex. If I selected 13 in the first drop down and double needle in the second, I would like "SYMBOL B" to be pulled from the library and centered on the artboard.
    I've gotten the UI to pop up and it works as planned as well as bringing in a symbol, my problem comes when I try to incorporate conditionals and functions.
    Here is my script. Please let me know what I'm doing wrong.
    var myDoc = app.activeDocument;
    var Pallette = new Window ("dialog", "Create a Shell");
    Pallette.add ("statictext", undefined, "Fill Opening in Inches:");
    Pallette.orientation = "row";
    var myDropdown =  Pallette.add ("dropdownlist", undefined, ["10", "13", "18"]);
    myDropdown.selection = 1;
    var myButtonGroup =  Pallette.add ("group");
    myButtonGroup.orientation = "column";
    var btnCreate = myButtonGroup.add ("button", undefined, "OK");
    MyFillSelection = myDropdown.selection
    btnCreate.onClick = function () {
        if ( MyFillSelection = "13") {
                   symbolRef = myDoc.symbols["SYMBOL A"];
            symbolItemRef1 = myDoc.symbolItems.add(symbolRef);
           redraw();
    var btnCancel = myButtonGroup.add ("button", undefined, "Cancel");
      Pallette.show ();
    If anyone has any input, it would be much appreciated.
    thanks,

    MyFillSelection = myDropdown.selection is outside the function, so it will always read "13", nothing is making the value change.
    move that line into your function and add the text property to it...MyFillSelection = myDropdown.selection.text;
    then do your if comparisons, that will do it.

  • Using JavaScript to Print and Overwrite Active Form Files

    Hello all,
    I have zero knowledge of JavaScript and I am hoping someone can help me
    quickly solve an issue I am having with active forms. I tried using the flatten
    feature in the action wizard but it is not working. I also tried using
    "this.flattenPages()" but I can still edit the fields in my PDF file.
    What I am looking for is a JavaScript command that allows me to overwrite the existing
    PDF file using the PDF printer and overwrite the active form so it is
    finalized. Maybe there is an easier more efficient way to accomplish this? Any
    input or help would be much appreciated. I am using Adobe Acrobat XI
    Pro. Thanks.
    P.S. I realize I can manually selected the Adobe PDF printer and finalize my
    active form that way but I am looking for a one click solution.

    Have you seen these?
    A tutorial on how to flatten form fields:
    http://acrobatusers.com/tutorials/how-to-flatten-form-fields
    And a free "Flatten Page Content" tool:
    http://www.pdfscripting.com/public/Free_Acrobat_Automation_Tools.cfm

  • Use Javascript to disable fields in tabular form built by wizard

    i know this type of disable question has been asked before and i have searched the forum thoroughly but the solutions always seem to be for items i.e P1_NAME and i do not have these as my form is built by a select statement
    i have worked out the syntax (i think)
    <script language="javascript" type="text/javascript">
    function desactiverElement(item)
    var x = document.getElementById(item);
    if (x)
    x.disabled = true;
    </script>
    to disable and think it goes in the html header or a html region before footer but i cannot work out how to disable the field because i cannot work out how to reference them
    i.e get the value for 'item' in the code
    any help i would be extremely grateful for
    cheers Chris

    the CENTRE_NO field has to be unique , and when i am doing my validation check ,if the user amends the field by accident and then replaces the value it gets an error when it shouldn't
    wish it was as simple as forms just change property to update_allowed = false !!

  • Using JavaScript to change field in a Form

    I have a form with few fields. When a field 1 changes, I want field 2 automatically changes to "TBD". Can I do that with Javascript OnChange?
    Obviously I tried that but it doesn't work. I don't know much about javascript. Any help is appreciated.
    650-604-3035
    [email protected]

    Hi,
    Since in forms the fields are named diffently you cannot directly access the variables by the name. For example the column "EMPNO" in a form "EXAMPLE_FORM" is named as "EXAMPLE_FORM.DEFAULT.EMPNO.01"
    In the onChange event of field 1 the code would be something like this.
    for (i=0;i<document.forms[0].elements.count;i++)
    //gets the value of <field_name_1>. <field_name_1> can be copied from the html source.
    if (document.forms[0].elements.name == "<field_name1">)
    l_value = document.forms[0].elements[i].value;
    //sets the value of <field_name_2>. <field_name_2> can be copied from the html source.
    if (document.forms[0].elements[i].name == "field_name2")
    document.forms[0].elements[i].value = l_value;
    Hope that helps.
    Thanks,
    Sharmila

  • Dynamically validating datatable elements using javascript

    Hai, iam using jsf, and having Xml mapping to the form elements to display the data . Iam using <h:datatable> inside which iam haveing repeated elements, i need to do a javascript validation before displaying the form element present inside the <h:datatable> columns.Iam also using <j4j:idproxy> , the java script is working for 1 iteration but it is the dataof the form element is not getting overridden in the 2nd iteration, It is somethinglike this below.
    <TR id="buiCoverRowId" style="display:none;">
    <TD height="9" width="200"></f:verbatim> <h:outputText
    styleClass="outputText" id="text7"
    value="Buildings Cover"></h:outputText><f:verbatim></TD>
    <TD height="9" width="516"></f:verbatim> <h:outputText
    styleClass="outputText" id="buildCoverId"
    value="#{pathPart.xpathMap['./BuildingsCover/CoverDetail/SumInsured/Amount']}">
    </h:outputText> <f:verbatim></TD>
    </TR>
    <TR>
    <TD></f:verbatim><f:verbatim>
    <h:inputHidden id="hidBuiCoverId"
    value="#{pathPart.xpathMap['./BuildingsCover/CoverDetail/SumInsured/Amount']}">
    <j4j:idProxy id="hidBuiCoverId_" />
    </h:inputHidden>
    </f:verbatim><f:verbatim></TD>
    <TD></f:verbatim><f:verbatim>
    <h:inputHidden id="hidExBuiCoverId"
    value="#{pathPart.xpathMap['./BuildingsCover/ExcludedInd/Value']}">
    <j4j:idProxy id="hidExBuiCoverId_" />
    </h:inputHidden>
    </f:verbatim><f:verbatim></TD>
    </TR>
    <SCRIPT>
    alert("HAI");
    var buidcover = document.getElementById('hidExBuiCoverId_').title;
    var buidcoverR =document.getElementById(buidcover).value;
    alert("the value of buildcover----->"+buidcoverR);
    var buId =document.getElementById('hidBuiCoverId_').title;
    var entitybuId1 = document.getElementById(buId).value;
    entitybuIdT1 = trim(entitybuId1);
    alert("entitybuIdT1"+entitybuIdT1);
    var buExId = document.getElementById('hidExBuiCoverId_').title;
    var entitybuExId1 = document.getElementById(buExId).value;
    entitybuExIdT1 = trim(entitybuExId1);
    entitybuExIdU1 = entitybuExIdT1.toUpperCase();
    alert("entitybuExIdU1"+entitybuExIdU1);
    if(!(entitybuIdT1 == null || entitybuIdT1 == '') && ((entitybuIdT1 == "0")) && (entitybuExIdU1 == 'FALSE'))
    document.getElementById("buiCoverRowId").style.display="block";
    </SCRIPT>
    The form element is mapped to the xml. the above code is written within a datatable, iam using javascrpt within this to display the datat or not, it is working for first iteration but its not working for second iteration. Plz help me with this . Is there any way that i can use javascript so that it vvalidates the form elements even for the 2 iteration of the datattable. I am having thesame values (of the 1iteration) even during the 2 iteration. Plz help me with this asap.

    Got the solution.
    $("div.ms-acal-rootdiv div div div a").html().replace('Replace this text only.','Replaced Text');

  • Using JavaScript with Acrobat XI Standard

    I am part of a transition team setting up a new correctional facility. I am working with our IT dept to purchase licenses for Acrobat XI. I need to get a definitive answer on using JavaScript with XI standard. The forms I am working with have a variety of scripts mostly button activated. Actions include saving and renaming files to a networked drive. Money is always an issue so if I can use XI standard that would be the better financial choice. The documents will not be created using XI standard just processed.

    This is the Reader forum; the Acrobat one is here:
    http://forums.adobe.com/community/acrobat

  • Monthly payments for using itunes?

    I'm getting these payments size of a like 2€ (euros) and I don't understand the reason. I got the first payment when I registrated my credit card and second when I downloaded first (it said it's free) thing from the itunes shop on my ipod touch, and third one when I actually bought something, and the thing what I bought was 2€ + 2€ (for what, if I may ask?)
    And I talked with my friend, and he said, he too gets this kinda every monthly payments, just for.. useing the software?
    If it's so, then I understand, but there's no information about the taxes?! And apple store account purchase history shows no sign about it, what so ever.. so what the f. is going on?
    (and I can't change the credit card data, 'cuz every time I click on the button "edit payment information" it just displays error, that the service is temp. unavailable) and the helpline.. It directs me to another countrys helpline.. I mean what? I have to make international phone call to get info for that? You know how much it will cost me?

    There is no monthly fee for the iTunes Store. You pay only for what you purchase. However, when you open a new account, or enter in a new credit card (and possibly when you update your credit card, for instance with a new expiration date), the iTune Store will put a small hold on your account to verify that the credit card is valid. That hold should be removed by your bank within a few days.
    Check your Purchase History and see if is shows any record of these charges. If it does and it's not something you expected to be charged for, ontact the iTunes Store Customer Service department using the form on their Support page (select the category and subcategory closest to the issue you're reporting and you'll find an "Email Us" button) and explain your situation to them.
    If you see purchases made that you did not make yourself, immediately change your password to your account, then contact your credit card company and report the charges as possibly fraudulent. Do the same if you are being charged but you see no matching purchases in your Purchase History.
    Regards.
    P.S. The iTunes Store has no telephone support. You use the contact form I linked above.
    Message was edited by: Dave Sawyer

  • Addition of fields in Adobe forms using JavaScript or FormCalc

    Hi All,
    I have a few amount fields in my Adobe form. I want to calculate their sum and show it in another textfield. Any ideas how this is done using JavaScript or FormCalc.???
    Thanks and Regards,
    Sameer

    Hi Sameer,
    you cant use JavaScript here in Web Dynpro. But if you want to calculate the sum through a button click that can be done through the Action Handler method.
    Suppose you have 2 fields to add whichare field1 and filed2 in the context tree and the sum will be shown in field3 of context tree - all of numeric data type - obviously. So you can do the following in the action handler method.
    int sum = wdContext.currentContextElement().getField1() +
              wdContext.currentContextElement().getField2();
    wdContext.currentContextElement().setFields3(sum);
    Regards,
    Shubhadip

  • Problem with using javascript in interactive adobe form

    Hi All,
        I have a problem when accessing text field value which is present inside a subform using javascript.
    I tried giving data.page4.sub-5.<fieldname>.rawvalue but its not working. Please provide a solution.
    Thank you in Advance.

    Since this question is related to JavaScript running within the Form and not the connection between the form and Web Dynpro - it really belongs in the Interactive Forms by Adobe Forum.

  • How do I use acrobat to calculate quantity/price as a form?

    Hello, I am trying to find out how to complete a form in acrobat pro using fields to calculate quantity/prices, ending in the field "TOTAL". This form is designed in illustrator. Here is a picture of the form: http://db.tt/gJsLWngT  Can anyone help me complete to process? If I am taking the wrong approach to this please let me know. I would greatly appreciate it, thank you.

    You need to place text fields as your Quantity and Total columns, 2 in each
    row.
    For example, in the first row you can create: Quantity1 and Total1
    Set up the quantity fields to accept only numbers (under Format).
    The total fields should be set to be read-only, and under Calculate you can
    use the Simple Field Notation to calculate their value.
    In the case of Total1, you can use something like this (for the retail
    price):
    Quantity1 * 35
    The value will be automatically updated whenever the value of Quantity1
    changes.
    For the last total field, use the first calculation option: Value is the
    (sum) of... and then select all the other total fields from the list.
    There are many more things that you can do...
    The tutorials on this website contains a lot of information about forms in
    PDF files:
    http://acrobatusers.com/tutorials

  • Getting error while using javascript in Forms 11g

    Hi All
    From OTN I have downloaded .zip file contains demo of Integrating Oracle Forms 11g with javascript.
    I have gone through every step and intergrated the javascript with Forms 11g.
    I am gettin an runtime error FRM-92190: JavaScript is unable to evaluate expression.
    Can anyone help me in this please.
    I placed every directory and file as mentioned in that demo.
    I use Win XP SP3,
    Forms [32 Bit] Version 11.1.1.4.0 (Production). patch set1.
    Internet Explorer 8.
    Thanks,
    Maddy

    Hi
    Thanks for your response
    I am just want to see how can a form looks using the javascript.
    and I want to use javascript in our Forms application to enhance them.
    If I can understand that demo it may be easy for me to implement the JS in our application.
    That error says that some wrong expression passed to the web.javascript_eval_expr
    js.html is placed here C:\Oracle\Middleware\asinst_1\config\FormsComponent\forms\server
    Left out files and directories are placed here C:\Oracle\Middleware\user_projects\domains\middleware_int\servers\WLS_FORMS\tmp\_WL_user\formsapp_11.1.1\e18uoi\war
    updated my .cfg and .env file as required.
    Is it problem with configuring the JS files and directory or Problem with javascript code????
    Thanks,
    maddy

  • How to seperate current page fields in a pdf form using javascript

    Hi,
    Is that possible to seperate current page fields(textbox, Chesckbox) in a pdf form using javascript.
    I have coding to get all the fields in a pdf form. But i want to take CURRENT PAGE alone.
    Please help me out.
    Thanks and regards,
    Christy

    Hi try67,
    Thanks for your support.
    I got the result.
    Thanks and Regards,
    Christy

  • Problem using javascript to submit jsf form, values not submitted

    Greetings!
    I have a t:selectOneMenu where I want the page to be submitted when they change the selected value. At this point, I am able to get the form to submit and reload the page, which is all fine. The problem is that none of the values from the page are not set in the backing bean. I have break points on the setter methods that are not being hit.
    I have tried a number of things from searching multiple forums, but here are snippets from my latest version...
    <h:form>
    <t:commandLink id="hiddenLink" forceId="true" value="test link"
    action="#{pc_PageX.doBtnHiddenLinkAction}"></t:commandLink>
    <t:selectOneMenu id="pageList_top" forceId="true" value="#{pc_PageX.ValueX}"
         onchange="jspellSync(); submitPageX();">
         <f:selectItems value="#{pc_PageX.ListX}" />
    </t:selectOneMenu>
    </h:form>
    function submitPageX(){
         var hiddenLink = document.getElementById("hiddenLink");
         hiddenLink.click();
    }Note that the <t:commandLink> is not hidden, though it will be in the final version if I can get this to work.
    If I click the commandLink myself, the page is submitted with all the page values as expected. If I change the list value, thus using javascript to fire the commandLink's click event, the page is submitted with NO values.
    Can anyone come up with an explanation for this behavior? Or better yet, a solution?
    A couple other things I've tried...
    - Not using a commandLink and using jsf's submit function -> onchange="jspellSync(); submit();"
    - Clicking the link using other ways -> hiddenLink.fireEvent('onclick');
    If all else fails, I'll just add a button that they have to click to submit the form.

    snotmare wrote:
    BalusC wrote:
    I recall this problem in one of the ancient JSF versions. Which JSF version do you use? Do you have any room to upgrade to latest? We're using an IBM implementation of JSF, which is at version 7.0. The IBM implementation appears to be built on the JSF base 1.1.That's not an IBM JSF implementation, they do not have any one, they just have some component libraries which runs on top of some JSF implementation. RAD/WSAD ships by default with Sun JSF RI. Try upgrading to at least 1.1_02 which you can download from the aforementioned link. There's a gap of 2 years (and inherently a lot of bugfixes) compared to 1.1. If the application server used supports Servlet 2.5, you could even upgrade to the latest 1.2.
    We've had other issues with the IBM implementation, which could be the cause in this case too. We've been talking about switching to MyFaces, but there is one feature of the IBM version that we like. It's basically a script collector (hx:scriptCollector) that allows us to do pre-processing on the page.As said before, IBM does not have a JSF implementation. So replacing RI by MyFaces wouldn't make any difference.

  • Using JavaScript to Determine a Form's Folder Name

    We have an awful lot of forms, and in many cases, our custom JavaScript applies to all forms in a given folder. We would like to determine the form's folder name so that we don't have to list each and every form in a giant "IF" statement.
    Has anyone figured out how to determine a form's folder using JavaScript?
    Thanks!
    - Jake

    Jake_Turrell wrote:
    I think the only solution to the "refresh" issue would be to somehow query the hsp_object table and grab the parent_id (which for a form is the folder ID). If anyone figures out how to query the application repository from JavaScript,that would be very, very cool.
    As the database is server side and javascript is client side you would have to use something like an ajax call that passes the form id into an jsp script, the jsp script would query the repository and return the value to javascript.
    Cheers
    John
    http://john-goodwin.blogspot.com/

Maybe you are looking for

  • How do I get my MacBook Pro w/ 10.8.4 to mirror to Apple TV?

    I can use Apple TV to play movies from my iTunes, but I have heard that I should be able to mirror my screen to the Apple TV, and I cannot. Under System Preferences>Displays I have a check box to show mirroring displays in the menu bar when available

  • Phantom image in PDF file

    I am working with Adobe Acrobat 9 Pro and MS Office 2007; my PC runs under Windows XP. I am experimenting with the MS Word "book fold" option and, so far, I got great results. Because this document must be printed overseas, I created it in A4 paper,

  • Upload documents from transactional screen - Sale & Purchase Order

    hi All, I am trying to have DMS attachment from trx - VA02 directly. I have come across few links which say - this is possible. upload documents from user transactional screen to content storage area | LinkedIn I am able to get the functionality for

  • Idoc status 52 - How to make it green i.e. 53

    My Idoc is coming in the receiver system as yellow color - status 52. No errors are shown. My data is not there. Do I need to do something to make the status green i.e. 53? I have already specified in WE21 to post immediately. Anything I am missing?

  • Inserting an html mini-site in a publication?

    Hi, folks I want to do a timeline about some facts in the past. This is a big scrolling frame and I have it built. So far, so good. Now I want each link to take the user to an HTML page describing the fact in a more detailed way. So far, so good as w