Calculating text fields

Hi folks! I am having a problem with my application which i hope you can help me to solve. Basically my application has 6 textfields were the user enters details about costs. I want to have another textfield (total) below these 6 which will show the total sum of these fields. i.e display the total cost...
This (total) textfield will have to be refreshed after the user enters a value into any of the 6 fields. I would prefer not to have the total value stored in my DB, and for it just to be displayed dynamically within the page.. Is this possible?? I would imagine it will require Triggers and mabey some Javascript??.. to be honest im not sure how to approach this. Has anyone got an example they can post me?
any help very much appreciated,
Roddy

<script language = "JavaScript1.1" type = "text/javascript">
calculateTotal() {
var total = 0;
total = html_GetElement('P6_CAP0708').value + html_GetElement('P6_OP0708').value;
html_GetElement('P6_TOTALAWARDED').value = total;
</script>First of all the function should be defined as function calculateTotal.
Try using the following:
<script language = "JavaScript1.1" type = "text/javascript">
function calculateTotal() {
var total = 0;
total = html_GetElement('P6_CAP0708').value + html_GetElement('P6_OP0708').value;
html_GetElement('P6_TOTALAWARDED').value = total;
</script>
Also call the Javascript function by putting the following in the items HTML Form Element Attrinutes entry :
onBlur="javascript:f_calculateTotal()";
NOTE: You will have to use parseFloat function to convert the strings ino numbers before adding otherwise it will concatenate the 2 values. For eg. Instead of giving 1+2 =2 it will give 1+1 = 11.
Hope this helps
Ameya.

Similar Messages

  • My calculation "Total" box adds sum of all text fields whether they are visible or not, do I change

    I have check boxes that show and hide text fields. (Thanks to Gilads Java script). In options I have a default value for each text field.
    My "Total" Field field adds all fields even if they are not checked and visible. Need to have it only include them if they are checked and visible.

    You can't attach forms by email, or any other means, so it didn't come through.
    Since your fields have default values and aren't calculated based on the state of the corresponding check box, you will have to use a custom calculation script for the Total field that can check to see if any of the fields are hidden, and if so, don't include their values in the sum. For example:
    // Custom calculation script
    (function () {
        // Set up an array of field names to include in the total
        var aFields = ["text1", "text2", "text3", text4"];
        // Initialize variables
        var i, f, sum = 0;
        // Loop through the fields an calculate the sum
        for (i = 0; i < aFields.length; i += 1) {
            // Get the current field
            f = getField(aFields[i]);
            // Add the value of the current field to the sum if the field is visible
            if (f.display == display.visible) {
                sum += +f.value;
        // Set this field value to the sum
        event.value = sum;
    You can send me a PM if you want help offline.

  • Calculated formula for replacing a comma with a Semicolon in a text field

    I need help replacing a comma with a Semicolon in a text field.
    I have a field that has names separated by commas.  
    Ex: Dog, Cat, Bird, Horse, Eagle, Worm, Snake
    I would like a calculated column that converts the field into: Dog; Cat; Bird; Horse; Eagle; Worm; Snake
    I figured out the first three positions (Dog, Cat, Bird,) but I can't figure out the rest.
    Using the formula below.
    =REPLACE((REPLACE((REPLACE([Title],SEARCH(",",[Title]),"1"," ; ")),SEARCH(",",(REPLACE([Title],SEARCH(",",[Title]),"1"," ; "))),"1"," ; ")),SEARCH(",",(REPLACE((REPLACE([Title],SEARCH(",",[Title]),"1","
    ; ")),SEARCH(",",(REPLACE([Title],SEARCH(",",[Title]),"1"," ; "))),"1"," ; "))),"1"," ; ")
    Please help

    check the similar post
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/66e2ae2a-4da9-4c58-a8bb-cf46b1bf448f/calculated-column-to-replace-commas?forum=sharepointgenerallegacy

  • Calculations in input text fields

    Hello,
    I'm making an engineering game. Students need to input force
    equations and to check the equation is right it has to add up to
    zero. There are two input text fields, one the student sees with
    the force values expressed in letters like HA, VA, and MA, and one
    hidden field where the values are expressed as numbers. They also
    input operators as part of the equation. I need to make it so when
    they click a button to check if their equation is correct, the
    contents of the text field are calculated to see if the equation
    adds up to zero. I know you can express the contents as a number
    with say Number (this.my_hidden_text.text), but how do I get the
    operators in the equation, which are +, -, *, /, (, ), and ^ to
    mean something and do what they're supposed to?
    Any assistance would be most welcome.
    Thank you for your time,
    Beatie3

    Thank you for your quick response. Would you mind explaining
    more how to use the strings method to find the operators, please?
    It's a bit messy but my code currently looks like this:
    stop();
    //hide stuff
    this.tickb._visible = false;
    this.crossb._visible = false;
    //declare the variables
    var check1:Number = parseInt(display_secret.text);
    var display1 = "";
    var display_secret = "";
    //function for the calculation
    function onCalculate() {
    if(this.display_secret = 0){
    this._parent.tickb._visible = true;
    this._parent.crossb._visible = false;
    } else {
    this._parent.crossb._visible = true;
    this._parent.tickb._visible = false;
    check02_btn.onRelease = function():Void {
    trace(display1);
    trace(check1);
    if(check1 == 0){
    this._parent.tickb._visible = true;
    this._parent.crossb._visible = false;
    } else {
    this._parent.crossb._visible = true;
    this._parent.tickb._visible = false;
    //load external images
    pic04_container.loadMovie("fig_3_1a.gif");
    //takes you back to the previous scene
    back02_btn.onRelease = function() {
    gotoAndStop("Scene 2", 1);
    //Takes you home
    home02_btn.onRelease = function() {
    gotoAndStop("Scene 1", 1);
    //moves to the next scene
    next02_btn.onRelease = function() {
    gotoAndStop("Scene 3a", 1);
    //calculator buttons workings
    left_btn.onRelease = function() {
    display1 = display1+ "(";
    display_secret = display_secret + "(";
    plus_btn.onRelease = function() {
    display1 = display1+"+";
    display_secret = display_secret +"+";
    times_btn.onRelease = function() {
    display1 = display1+"*";
    display_secret = display_secret +"*";
    right_btn.onRelease = function() {
    display1 = display1+")";
    display_secret = display_secret +")";
    minus_btn.onRelease = function() {
    display1 = display1+"-";
    display_secret = display_secret +"-";
    peek_btn.onRelease = function() {
    display1 = display1+"^";
    display_secret = display_secret +"^";
    slash_btn.onRelease = function() {
    display1 = display1+"/";
    display_secret = display_secret +"/";
    ha_btn.onRelease = function() {
    display1 = display1+"HA";
    display_secret = display_secret +"108";
    va_btn.onRelease = function() {
    display1 = display1+"VA";
    display_secret = display_secret +"0";
    ma_btn.onRelease = function() {
    display1 = display1+"MA";
    display_secret = display_secret +"1296";
    c_btn.onRelease = function() {
    display1 = "";
    display_secret = "";
    vd_btn.onRelease = function() {
    display1 = display1+"VD";
    display_secret = display_secret +"0";
    w_btn.onRelease = function() {
    display1 = display1+"w";
    display_secret = display_secret +"12";
    a_btn.onRelease = function() {
    display1 = display1+"a";
    display_secret = display_secret +"18";
    b_btn.onRelease = function() {
    display1 = display1+"b";
    display_secret = display_secret +"9";
    thank you very much for your help,
    Beatie3

  • Displaying the value of text field A in text field B

    I have a PDF form with 2 layers. Layer 1 has information, a textfield, and a button. Layer 2 is a certificate design. The user inputs their name in to a textfield called NameEntry.
    When they hit the button, layer 1 disappears -- the instructions and NameEntry box become hidden. Layer 2 is the certificate design and I need a new textfield (which is called NameDisplay) to be populated from inputted information in text field NameEntry.
    The simple answer, I know, is to name both text fields the same. This does not work for me as I need the input textfield to be styled differently (background and border) due to decisions out of my control vs the NameDisplay which will have no background and no border.
    Any ideas? Thanks!

    Use this custom calculation script:
    event.value = this.getField("NameEntry").valueAsString;

  • Acrobat javascipt problem with text field

    Hello.
    I work in hospital and I create a PDF with some javascript, to help us working with our patients. This PDF now need some upgrade and I m stuck. Im not a programmer, so its even more difficult to me.
    Let me describe my problem. I have three buttons in my PDF with this code: on mouse up run javascript (I replace actual names in menu with options)
    var cChoice = app.popUpMenuEx
       {cName: "Option1", oSubMenu:
          [ { cName: "A", cReturn: "A" },
            { cName: "B", cReturn: "B"},
            { cName: "C", cReturn: "C" }
       {cName: "Option2", oSubMenu:
          [ { cName: "D", cReturn: "D" },
            { cName: "E", cReturn: "E" },
            { cName: "F", cReturn: "F" }
    if(cChoice != "" && cChoice != null)
    this.SetFieldValues(cChoice);
    else if(cChoice != null)
                 this.print({bUI:true,bSilent:false});
    I also have four text fields in PDF, fields "d1", "d2", "d3" and field "kat".
    Inside document javascript I have setFieldValues script:
    // Place all pre-population data into a single data structure
    var DeptData = { "":{  diagnoza: "", kat: "" },
    "A":{ diagnoza: "A", kat: "KAT III" },
    "B":{ diagnoza: "B", kat: "KAT II" },
    "C":{ diagnoza: "C", kat: "KAT I" },
    "D":{ diagnoza: "D", kat: "KAT III" },
    "E":{ diagnoza: "E", kat: "KAT II" },
    "F":{ diagnoza: "F", kat: "KAT I"}};
    function SetFieldValues(cDeptName) {
        // Populate fields with values from the Department Data Object
        this.getField("d1").value = DeptData[cDeptName].diagnoza;
        this.getField("kat").value = DeptData[cDeptName].kat;
    function SetField1Values(cDeptName) {
        // Populate fields with values from the Department Data Object
        this.getField("d2").value = DeptData[cDeptName].diagnoza;
        this.getField("kat").value = DeptData[cDeptName].kat;
    function SetField2Values(cDeptName) {
        // Populate fields with values from the Department Data Object
        this.getField("d3").value = DeptData[cDeptName].diagnoza;
        this.getField("kat").value = DeptData[cDeptName].kat;
    Now my problem. This code work perfect for my d1, d2, and d3 fields. When nurse click first button and open menu, then select options, the value that she select print in field d1, value from second button print in d2 and value from last button in d3. But each selection has also second value, named "kat". This value must be printed in text field named "kat", but...here is some catch. If all three selected options have different "kat" values - all three values must be in text field "kat". If one or two values are equal, I need that just one of them is printed.
    Something like that:
    If
    "d1" field has "A" value
    "d2" field has "B" value
    and "d3" has "C" value
    then field "kat" has all three kat values.
    but if
    "d1" field has "A" value
    "d2" field has "D" value
    and "d3" field has "E" value
    then field "kat" print only one of two equal (A and B) kat values and E kat value, that is different.
    Anyone understand my bad english and my problem and has a solution for this?

    Use hidden text fields for the various "kat" values ("kat1", "kat2", etc.) and then a separate custom calculation script for the real "kat" field that looks at the values of those fields and decides what value it should have.

  • How to create a pdf/a-1b with a text field

    hello, I'm trying to execute a very simple task: create a pdf/a-1b containig a text field.
    using Acrobat XI pro, I created a simple pdf form with 1 form field of type text , then tried to save as pdf/A-1b. The pdf is saved but the form field is removed from resulting pdf.
    Here in detail the steps I made:
    0) configure adobe pdf printer to save as pdf/A-1b
    1) creat a test.txt with notepad
    2) print using acrobat pdf printer
    3) open the generated pdf with Acrobat XI
    4) in 'Standards' panel I see that pdf conform
    5) now go to 'Tools\Modules' and 'Modify'
    6) add a textbox field
    7) exit from 'Modify' mode and save
    8) in 'Standards' panel I see that pdf doesn't conform.
    9) I opened the preflight tool and see two errors
         a) "XMP property for a page object not predefined and no extension schema present".
         page reports the following Trigger values:
         - Extension schema is present in XMP: is not true
         - Property exists in PDF/A Standard: is not true
         b) Form field does not have an appearance dictionary
         page reports the following Trigger values:
         - Form field has an appearance dictionary: is not true
    I'm quite new to Acrobat: simply downloaded the Actobat XI evaluation version, created the file and added the text field. No special settings nor other configurations was applied,
    I'm wondering if someone else was able to reproduce this behavior.
    thank you for any comment

    First, about invalidating the PDF/A. I was told, but never had this confirmed nor tested, that editing a PDF/A will automatically cause the PDF/A status to be deleted from the file. This is because Acrobat does not know about the compatibility of every edit with every current (and future) PDF subset standard, so it is safest just to remove the indicator - if you turn off Adobe's PDF/A view mode which will prevent editing anyway.
    Now, you have a problem with the signatures. Possibly a very big one. Your description "2) fill the text field with some annotations and then sign the signature field 3) save the pdf" is a little too separated. At the time a file is signed it is saved, the hash calculated, and written to the file. So signing and saving are just one action. Yet an unsigned digital signature needs, it seems to me, no appearance.
    I think the solution is a simple one. Sign it, but not with a signature field. If it is PDF/A when you start it is probably PDF/A when you finish. Signature fields seem a distraction and obstacle to the important thing, signing.

  • How can I merge 3 or more individual text fields into an editable summary text field?

    I am stuck and do not know where to begin. I am self taught in using Adobe LiveCycle and have found many answers here in the forums and via trial and error.
    I cannot find or create the correct java script or form calc to feed multiple text fields into one text field.  My supervisor is asking me to do this for two sections of a form I created using Adobe LiveCycle Designer ES 8.2.
    1)       Merge all 3 user entered text fields to an user editable summary text field at the end of the form.
    2)       Merge all 24 user entered text fields to an user editable summary text field at the end of the form.
    Since they are all individual text fields in response to various questions, I cannot use the global binding function. I do not want the summary text field to override the individual text fields.
    Here is the java scripting I placed on Show: calculate* Language: javascript Run: at client
    1) PDStrengthWeaknessComments.rawValue + "_" + OCStrengthWeaknessComments.rawValue + "_" + CEBAStrengthWeaknessComments.rawValue;
    Needless to say, these instructions are not working on my form. Would someone with a lot of experience or an IT degree kindly help me?

    I just tried adding the front end as you suggested and confirmed that the Object > Value is set to "calculated - user can override" for the summary text field.
    OverallAnalysisAppFeedback.rawValue = PDStrengthWeaknessComments.rawValue + "_" + OCStrengthWeaknessComments.rawValue + "_"  + CEBAStrengthWeaknessComments.rawValue;
    I was still unsuccessful.
    I opened the debugger and received the following information. I do not understand what AdobeLiveCycle is asking me to define.
    PDStrengthWeaknessComments is not defined
    1:XFA:GARP2011NewRecompeteSRW[0]:Page20-OverallAnalysisAppFeedback[0]:AllOverallAnalysis[0 ]:calculate
    PDStrengthWeaknessComments is not defined
    1:XFA:GARP2011NewRecompeteSRW[0]:Page20-OverallAnalysisAppFeedback[0]:AllOverallAnalysis[0 ]:calculate
    Budget1Comments is not defined
    1:XFA:GARP2011NewRecompeteSRW[0]:Page21-OverallAnalysisAppFeedback-Budget[0]:AlBudgetQs[0] :calculate
    Budget1Comments is not defined
    1:XFA:GARP2011NewRecompeteSRW[0]:Page21-OverallAnalysisAppFeedback-Budget[0]:AlBudgetQs[0] :calculate
    Do you have any additional tips or suggestions?

  • How to put the return data from webservice to a text field

    Dear All ,
    I created a function module for calculating the square of the input given  and created a webservice using the create webservice option available for function modules.
    function module:-
    FUNCTION ZJK_FLEX_TEST.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(DATA) TYPE  ZSLNO OPTIONAL
    *"  EXPORTING
    *"     VALUE(DATA1) TYPE  ZSLNO
    *"  TABLES
    *"      IT_DAT STRUCTURE  ZWBSER OPTIONAL
    data: wa_dat LIKE LINE OF it_dat.
    data1 = DATA * data.
    wa_dat-results =  data * data .
    APPEND wa_dat TO it_dat.
    ENDFUNCTION.
    and i passed the it_dat in table fields and data1 in the export paramenters of FM.
    but in the flex i am not getting the table values. but i am able to get the data1 value. but the problem is . I am getting it as an XML format.
    <s0:ZJK_FLEX_TEST.Response xmlns:s0="urn:sap-com:document:sap:rfc:functions" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      <DATA1>0000025</DATA1>
    </s0:ZJK_FLEX_TEST.Response>
    so how to set the value of data1 to my text field in the flex .

    Hi Jay,
    resultFormat="e4x" will give you resultset in XMLListCollection otherwise resultset will be an ArrayCollection.
    For your example try with this statement after web service result:
    txtInput.text = ws.ZJK_FLEX_TEST.lastResult.DATA1.toString();
    where ws is id for web srvc and txtinput is a simple textInput control UI.
    I hope this will solve your query.
    Regards,
    Vivek

  • Adding Start and Stop characters to a text field???

    "For 1D bar codes, there are two options depending on the type of PDF form you want to use. Forms that you create in Acrobat (acroforms) can be set up to use a bar code font with a standard text field. If you want to include the standard start and stop character (*) and/or a check character, you can use JavaScript to add them. The check character would have to be calculated, but that can be easily done with JavaScript."
    How would i go about doing this. My current PDF form will pull a last name and first name onto the form in a Barcode format, but i need to add in *LNM to the start and another * at the end of the data that was pulled from a SQL data base.  example the pdf has a Text Feild named "borrower1_last_name" and that filed pulls the last name..  So i was thinking there should be an easy script like you said to add in to that feild properties.
    posting here now, becasue no one seems to be able to point me to the correct resourse on the reader forum.

    okay.. so now how do I change the space between the first name and middle inital (and even the last name) in that same field?
    something like this looks like it should work but doesnt seem to do anything.
    str.replace(/ /g, "_");
    // Add an asterisk to the beginning and end of the value
    if (event.value) event.value = "*FNM" + event.value + "*";
    //Replace black spaces with an Underscore
    str.replace(/ /g, "_");

  • Button Setting Variable - Text Field Not Updating

    Hi,
    I am working with Acrobat 9 Pro on Windows.
    I am unable to make the following work: When the user clicks a Button, a Text Field appears with the text associated with the Button clicked. I have tried accomplishing this with a variable declared in the Document JavaScripts, buttons setting the value of the variable, and a Text Field containing a Custom Calculation Script that returns the text associated with the value of the variable.
    Everything works - except the Text Field doesn't return the text associated with the value of the variable. I have an app.alert (for now) in the button scripts so I can see if the variable has the correct value - and it does - but when the Text Field appears - the text never changes.
    What I have observed: if I go back into the Custom Calculation Script of the Text Field and do nothing, go back out, go to Preview, and click on a Button, the text updates to the previous variable value (not the Button variable value I just clicked).
    So - I think - the Custom Calculation Script isn't seeing the new variable "on the fly". Even though the app.alerts are. I don't think this is a Field Calculation Order problem. But maybe it is. And this is where my brain power ends. Any suggestions would be greatly appreciated. Thank you.
    I have this in the Document JavaScripts:
    var ITrig = 1;
    I have three Buttons (want to have more) that will set the ITrig variable.
    Here is what I have in one Button:
    var Inpopup = this.getField("PartASectionIIInstructions")
    ITrig = 2;
    app.alert(ITrig);
    if (Inpopup.display == display.hidden) {
    Inpopup.display = display.visible
    Inpopup.setFocus();
    } else {
    Inpopup.display = display.hidden;
    I have this in the PartASectionIIInstructions Text Field in the Custom Calculation Script:
    if (ITrig == 2) {
    event.value = "#2";
    else if (ITrig == 3) {
    event.value = "#3";
    else if (ITrig == 4) {
    event.value = "#4";

    Thank you. I had tried something like that earlier - without success. That is why I went to the calculation script. So - I went back to the "Acrobat Forms - JavaScript Object Specification" looking for an answer. It finally sunk in I was guilty of this:
    var Inpopup = this.getField("PartASectionIIInstructions").value
    Inpopup = "#3"
    When I should have been doing this:
    var Inpopup = this.getField("PartASectionIIInstructions")
    Inpopup.value = "#3"

  • Please, help with text field on form

    Hello,
    I am creating a form.  I have a text field where the person will type a number into text field and I need it to also enter in another text field.  For example, the person enters 23 into text field 12, I also need the entry of text field 12 to show up in text field 63.  Is this possible?  I'm VERY new to this, so a step by step response would be greatly appreciated!
    Thank You!!!
    Debby

    This requires a script as you have to first verify that the denominator is not blank or zero, or you'll get an invalid operation.
    Something like this should work as the custom calculation script of your field:
    var s1 = this.getField("Text2").valueAsString;
    var s2 = this.getField("Text3").valueAsString;
    if (s1!="" && s2!="" && Number(s2)!=0) event.value = Number(s1)/Number(s2);
    else event.value = "";

  • Using Javascript to create concatenated string from checkbox fields to one text field

    Hi. I have a PDF form that I am trying to have output to a spreadsheet that matches my database schema. Here is the dilemna:
    * I have a set of checkboxes for available languages (LANGUAGE_ENGLISH, LANGUAGE_SPANISH, etc.) When they export to spreadsheet, the value is TRUE.
    * I need to take values from checked boxes and create a single string in a text field called LANGUAGE_DISPLAY (so my UI will not need to do the concatenation). If LANGUAGE_ENGLISH is TRUE (checked), append "English, " to LANGUAGE_DISPLAY, else append "". Then, if LANGUAGE_SPANISH is TRUE (checked), append "Spanish, " to LANGUAGE_DISPLAY, else append "". And on and on
    In the LANGUAGE_DISPLAY text field properties, I am inserting a Custom Calculation script to try to achieve this, but am not getting any results. I tried teh following even trying to pull the checkboxes default values and string them together:
    box1 = this.getField("LANGUAGE_ENGLISH").value.toSrting();
    box2 = this.getField("LANGUAGE_FARSI").value.toSrting();
    box3 = this.getField("LANGUAGE_MANDARIN").value.toSrting();
    event.value = box1 + ', ' + box2 + ', ' + box3;
    I also played with this to get the desired strings output...but to no avail:
    if ( LANGUAGE_ENGLISH.rawValue == true )
    box1.rawValue = "English, ";
    if ( LANGUAGE_FARSI.rawValue == true )
    box1.rawValue = "Farsi, ";
    if ( LANGUAGE_HEBREW.rawValue == true )
    box1.rawValue = "Hebrew, ";
    event.value = box1 + box2 + box3;
    Then I tried to simplify to see one field output so used this script...still no results:
    event.value = "";
    var f = this.getField("LANGUAGE_ENGLISH");
    if ( f.isBoxChecked() == true) {
    event.value = "English";
    Couple questions:
    1) Am I on the right track with any of these scripts?
    2) Is there something else I need to do to get the script to run before running the Create Spreadsheet with Data Files comman in Acrobat to get my csv file output? Maybe there needs to be some event to get the checkbox values read by that field in order to calculate/create the string.
    Appreciate any help you can provide.

    LiveCycle Designer has shipped with all Acrobat Professional versions since the "Professional" version was introduced with version 6.
    You do not let us know want results you get in the field or the JavaScript console.
    Using:
    box1 = this.getField("LANGUAGE_ENGLISH").value.toString();
    box2 = this.getField("LANGUAGE_FARSI").value.toString();
    box3 = this.getField("LANGUAGE_MANDARIN").value.toString();
    event.value = box1 + ', ' + box2 + ', ' + box3;
    returns "Off, Off, Off", when no box is checked and returns "Yes" for the appropriate box being checked when the default value is used for the creation of the check box. So if one would make the 'Export Value' of the box from the default value of 'Yes" to the appropriate language, one would get a more desirable result. But for each unchecked box the value would appear as "Off". So one needs to change the 'Off' value to a null string. But one is still left with the separator when there is an unchecked option.
    Using the following document level function:
    // Concatenate 3 strings with separators where needed
    function fillin(s1, s2, s3, sep) {
    Purpose: concatenate up to 3 strings with an optional separator
    inputs:
    s1: required input string text or empty string
    s2: required input string text or empty string
    s3: required input string text or empty string
    sep: optional separator sting
    returns:
    sResult concatenated string
    // variable to determine how to concatenate the strings
    var test = 0; // all strings null
    var sResult; // re slut string to return
    // force any number string to a character string for input variables
    s1 = s1.toString();
    s2 = s2.toString();
    s3 = s3.toString();
    if(sep.toString() == undefined) sep = ''; // if sep is undefined force to null
    assign a binary value for each string present
    so the computed value of the strings will indicate which strings are present
    when converted to a binary value
    if (s1 != "") test += 1; // string 1 present add binary value: 001
    if (s2 != "") test += 2; // string 2 present add binary value: 010
    if (s3 != "") test += 4; // string 3 present add binary value: 100
    /* return appropriate string combination based on
    calculated test value as a binary value
    switch (test.toString(2)) {
    case "0": // no non-empty strings passed - binary 0
    sResult = "";
    break;
    case "1": // only string 1 present - binary 1
    sResult = s1;
    break;
    case "10": // only string 2 present - binary 10
    sResult = s2;
    break;
    case "11": // string 1 and 2 present - binary 10 + 1
    sResult = s1 + sep + s2;
    break;
    case "100": // only string 3 present - binary 100
    sResult = s3;
    break;
    case "101": // string 1 and 3 - binary 100 + 001
    sResult = s1 + sep + s3;
    break;
    case "110": // string 2 and 3 - binary 100 + 010
    sResult = s2 + sep + s3;
    break;
    case "111": // all 3 strings - binary 100 + 010 + 001
    sResult = s1 + sep + s2 + sep + s3;
    break;
    default: // any missed combinations
    sResult = "";
    break;
    return sResult;
    And the following cleaned up custom calculation script:
    box1 = this.getField("LANGUAGE_ENGLISH").value;
    box2 = this.getField("LANGUAGE_FARSI").value;
    box3 = this.getField("LANGUAGE_MANDARIN").value;
    if (box1 == 'Off') box1 = '';
    if (box2 == 'Off') box2 = '';
    if (box3 == 'Off') box3 = '';
    event.value = fillin(box1, box2, box3, ', ');
    One will get the list of languages with the optional separator for 2 or more language selections.

  • Can't get a text field to atuo populate based upon a dropdown selection

    I have a drop down box with 3 values that can be selected:
    Dropdown2 = 101-3 subd.A
                          101-3 subd.B
                          101-3 subd.C
    I am trying to get a text field to auto populate based upon the selection:
    if Dropdown2 = 101-3 subd.A then Text4 = "ValueA"
    if Dropdown2 = 101-3 subd.B then Text4 = "ValueB"
    if Dropdown2 = 101-3 subd.C then Text4 = "ValueC"
    I have tried to create a custom calculation script for Text4:
    var v= getfiled("Dropdown2").value;
    if (v="101-3 subd.A") event.value = "ValueA";
         else if (v="101-3 subd.B") event.value = "ValueB";
         else if (v="101-3 subd.C") event.value = "ValueC";
         else event.value = " ";
    I have entered this script and the syntax appears to be correct.(At least to Acrobat XI.  I'm know programmer and have just enough knowledge to be dangerous).  When I select a value in Dropdown2 nothing happens.  No value appears in Text4.  I have checked the "commit selected value immediately" in the option of Dropdown2 per some google'ing.  I just can not understand why the values do not appear.  Any help would be appreciated.
    Thanks

    I made the changes and added the == to my if statements.  When I select a value in Dropdown2, Nothing appears in Text4.  I don't understand.  Is there something else that I need to do beside event.value="Some Value";?
    I know it has to be something simple that I am missing, but I just can't seem to see it.
    Text4 - Custom Calculation Script:
    var v= getfiled("Dropdown2").value;
    if (v=="101-3 subd.A") event.value = "ValueA";
         else if (v=="101-3 subd.B") event.value = "ValueB";
         else if (v=="101-3 subd.C") event.value = "ValueC";
         else event.value = " ";

  • How to add comma and dollar sign that places automatically in input text field

    I have this ROI calculator which has several text input field
    on frame one with calculate and reset buttons. When a user enters
    numerical values in the text field, and jumping to the next field,
    I want the input text filed be updated with dollar sign and with
    comma.
    Next when they hit "ENTER" key or click "Calculate ROI"
    button, all the input text fields on frame 2 as a result of
    calculations be updated with dollar sign and comma. I also need
    that once the comma sign is assigned then it would not add any more
    even if user presses the button. Can someone help me in
    this?

    If you want to Set the Comma when you Switch to next Text
    Field
    Use onKillFocus / onSetFocus Functions.
    to restrict multiple comma, Before Adding comma use
    myText.text =
    myText.text.split(",").join("").split("$").join("");
    So this will give you the value without Comma and Dollar
    symbol, Now add the Comma and dollar.
    or you need to use a Flag for onChange Event.

Maybe you are looking for

  • Message control application

    Hello all, I want to know how to do the message control setting in EDI (R/3) and PartnerProfile for a vendor(LI). Thanks in advance, Regards, Vaaneshree

  • Not getting N status for E3000

    I just reconfigured my router after some problems and I'm not able to get N status on it. My wireless adapter only reads G right now, so I only get speeds of 54 max Mbps rate. How can I go about letting it get N status? I know it's not my wireless ad

  • Choose from list - data display with condition

    Hi, I 've developed a form using screen painter, I ' ve attached a choose from list to fill GRPo Number.  In the choose from list the GRPo no. should not display again which once I have selected and saved.  Let me have a good solution please and it w

  • AD connector installation error

    DOBJ.XML_IMPORT_ERROR oracle.iam.reconciliation.exception.ConfigException: oracle.iam.platform.entitymgrSchemaUpdateException: ALTER TABLE RA_UD_ADUSRC DROP COLUMN RECON_MEMBEROF this is 11.1.1.5.2 oim with 11.1.1.5.0 AD connector. Any ideas? Thanks.

  • Inserting records using DB link

    Hi, I'm trying to insert a record using a db_link into a table which has EXTRAFIELDSTYPE column and I'm getting the error PLS-00453: remote operations not permitted on object tables or user-defined type columns. Is there anyway I can insert records i