FormCalc vs JavaScript question

Well, then to be consistent throughout my form I would use JavaScript throughout my form.  In addition, it is easier to use.  Unfortunately, there is a behavior in FormCalc I can't reproduce in JavaScript, and I need it to work.  Here's the script in FormCalc

var vnum = _Body.count
var selection = xfa.host.messageBox ("attention! You are about to permanently delete this entry.  Are you sure you want to continue? "," danger! ", 3, 2).

If ((vnum == (this.parent.index + 1)) & (vnum <>1) & (choice == 4)) then
Body [this.parent.index - 1]. Radio_Button_Subform.Radio_Button_Group.RawValue = "2"
endif

If (choice == 4) then
_Body.removeInstance (this.parent.index)
endif

and here is my attempt to replace using JavaScript

var vnum = _Body.count;
var selection = xfa.host.messageBox ("attention! You are about to permanently delete this entry.  Are you sure you want to continue? «, "danger!", 3, 2);»

If ((vnum == (this.parent.index + 1)) & & (vnum! = 1) & & (choice == 4))
Body [this.parent.index - 1]. Radio_Button_Subform.Radio_Button_Group.RawValue = '2';

If (choice is 4)
_Body.removeInstance (this.parent.index);

I tested it on and I know that the problem occurs with the line

Body [this.parent.index - 1]. Radio_Button_Subform.Radio_Button_Group.RawValue = '2';

However, I do not understand why this reference is not valid JavaScript when it worked in FormCalc, and I don't know how to operate it.

Thanks for your help.

Hello

For the javascript version replace youre code with the following:

xfa.resolveNode ("Body [" +(vnum-2) +""].. ") RawValue Radio_Button_Subform.Any_other_property_of_this_type') = '2 ';

Also check fix, hope this is what you need.

BR

Tags: Adobe LiveCycle

Similar Questions

  • FormCalc or Javascript for the radio buttons?

    I need to write a script that uses radio buttons.

    If a radiobutton is selected (my radiobuttion is called rbJanuary) then textbox1 = textbox2.

    How I write this and it's in FormCalc or Javascript? Thank you!

    Hello

    It doesn't matter what language you use for your request, it will work in both while FormCalc has a thinner syntax.

    FormCalc:

    if ($ eq 1) then
              Textfield1 = Textfield2
    else
              Textfield1 = ""
    endif
    

    JavaScript:

    if (this.rawValue === "1") {
              Textfield1.rawValue = Textfield2.rawValue;
    } else {
              Textfield1.rawValue = "";
    }
    
  • JavaScript question - do not click on dates in a calendar

    We try on online tennis court booking site. When I click the calendar icon to select a date in the calendar, I can click on the date, but he does not at that date.

    Other browsers such as Chrome and Internet Explorer work fine. It just goes straight to the date I click.

    <"rel = 'nofollow' > http://demo3.onlinecourtreservations.com/Reservations.asp > demo version"

    <"rel = 'nofollow' > http://mum.onlinecourtreservations.com/Reservations.asp > our trial version."

    Here's what I sent to the developer and his answer is below.

    My Question: When you use the calendar for date selection tool, I noticed that it will not to the date on the calendar that I click. I can navigate using the arrows of day view and the view arrows week next to the icon of calendar very well.

    DEVELOPER RESPONSE: The calendar tool is based on javascript, so the security of your browser must allow scripts. To do this, the simplest method is to add your site to the "trusted sites" on your browser.

    The steps I've tried:
    1. the reset of the functionality of Firefox
    2. clear all history
    3. start in Safe Mode
    4. check to make sure that javaScript is enabled and it is.

    I wonder why this works fine in Chrome and Internet Explorer and not Firefox.

    Could someone help me solve the problem?

    Thank you.

    If you use this script, you can change it?

    The pop-up tries to submit a form hidden in the main window using a standard, old SEO method. You can correct the script in the pop-up window, or you can create a reference in the main window.

    Method #1:

    Change the code in the popup

    reservation_window.frmCalendar.submit();
    

    for this

    reservation_window.document.forms['frmCalendar'].submit();
    

    Method #2:

    In the main window, create a global script variable that creates the missing reference:

    window.frmCalendar = document.forms['frmCalendar'];
    

    Once solve you this problem, there is a new number. Web site empty, and when you view the source, you see that there is a problem with one of the hidden form parameters.

    Microsoft VBScript runtime error '800a000d'
    Type mismatch: 'CInt'
    /demo/common/reservationssheet/script.asp, line 25
    

    Since it is on the server, I don't know what goes wrong, but the script apparently don't deal well with a time value start missing. For what it's worth, I get the same error in IE8.

  • Tips: JavaScript Question

    Beginner tips:

    1. how to express default script date today

    2. entry by default convert lowercase to uppercase

    Thank you

    Hello

    to complete todays date use FormCalc in the docReady event.

    if ($.isNull) then
         $ = Num2Date(Date(), "DD/MM/YYYY")
    else
         $.rawValue
    endif
    

    To change the lower case to upper case using JavaScript in your field change event.

    xfa.event.change = xfa.event.change.toUpperCase();
    
  • Simple Javascript question

    Please forgive me, I am very new to JavaScript and Acrobat.

    Can someone tell me the phrase I would use to several a number entered by a user; which would be multiplied by a fixed number? Please see image:

    The user number of backpacks, they enter the first area, the second box would have several sales of 50.

    Please let me know if you have any question. I spent some time trying to get this to work, everything I try the product and error.

    Your help is very appreciated!

    Hi rachelNS,

    You can send me a sample form and I would try it for you.

    Then you check the script on your side. Also, I would like to know what is the version of Acrobat you are using?

    Kind regards

    Ajlan Huda.

  • Javascript question (API) labels DYMO

    Hi all.

    APEX 4.2
    11 GR 2 XE database.


    I am trying to print labels directly from APEX through a library of JS of DYMO (DYMO label for javascript framework).
    I want to fetch the XML code for the type of representation dynamically from the database instead of fixed this assignment in JS, which kind I can store all templates for labels in the database and find the one appropriate for the task, I do).
    If I use the fixed code, it works very well, code looks like this (sheet of labels XML is assigned to the variable labelxml in the first few lines):
    function printadres(labeltext )
    {
        try
         { 
    var labelxml = '<?xml version="1.0" encoding="utf-8"?>\
        <DieCutLabel Version="8.0" Units="twips">\
            <PaperOrientation>Landscape</PaperOrientation>\
            <Id>Address</Id>\
            <PaperName>30252 Address</PaperName>\
            <DrawCommands/>\
            <ObjectInfo>\
                <TextObject>\
                    <Name>Text</Name>\
                    <ForeColor Alpha="255" Red="0" Green="0" Blue="0" />\
                    <BackColor Alpha="0" Red="255" Green="255" Blue="255" />\
                    <LinkedObjectName></LinkedObjectName>\
                    <Rotation>Rotation0</Rotation>\
                    <IsMirrored>False</IsMirrored>\
                    <IsVariable>True</IsVariable>\
                    <HorizontalAlignment>Left</HorizontalAlignment>\
                    <VerticalAlignment>Middle</VerticalAlignment>\
                    <TextFitMode>ShrinkToFit</TextFitMode>\
                    <UseFullFontHeight>True</UseFullFontHeight>\
                    <Verticalized>False</Verticalized>\
                    <StyledText/>\
                </TextObject>\
                <Bounds X="332" Y="150" Width="4455" Height="1260" />\
            </ObjectInfo>\
        </DieCutLabel>';
    
              var label = dymo.label.framework.openLabelXml(labelxml);
    
              // set label text
              label.setObjectText("Text", labeltext);
                             
              // select printer to print on
              // for simplicity sake just use the first LabelWriter printer
              var printers = dymo.label.framework.getPrinters();
              if (printers.length == 0)
                   throw "No DYMO printers are installed. Install DYMO printers.";
    
              var printerName = "";
              for (var i = 0; i < printers.length; ++i)
              {
                   var printer = printers;
                   if (printer.printerType == "LabelWriterPrinter")
                   {
                        printerName = printer.name;
                        break;
                   }
              }
                             
              if (printerName == "")
                   throw "No LabelWriter printers found. Install LabelWriter printer";

              // finally print the label
              label.print(printerName);
         }
         catch(e)
         {
              alert(e.message || e);
         }
    };
    but when I try to fetch the same XML from a text field on my form it fails with a "getObjectByNameElement(): no object with name 'Text' was found" error which is a custom error from the DYMO library.
    I'm unable to find the big difference in the 2 approaches. If I test the variable labelxml by putting it in an alert the value seems fine ( it contains the XML string which is in P11_LABELTEMPLATE which is exactly the same as the static assigned text in the previous example ).
    The code then looks like this :
    function printadres (labeltext)
    {
    VR;
    {
    var labelxml = $v ('P11_LABELTEMPLATE'); It's dynamic assignment that fails somehow

    var label = dymo.label.framework.openLabelXml (labelxml);

    the text of the label value
    label.setObjectText ("Text", labeltext);

    Select the printer to print on
    for simplicity just use the first printer LabelWriter
    var printers = dymo.label.framework.getPrinters ();
    If (printers.length == 0)
    launch 'no DYMO printer is installed. Install DYMO printers. « ;

    var printerName = "";
    for (var i = 0; i < printers.length; ++ I)
    {
    Printer printers [i] = var;
    If (printer.printerType is "LabelWriterPrinter")
    {
    printerName = printer.name;
    break;
    }
    }

    If (printerName == "")
    not launch "no printer found LabelWriter. Install printer LabelWriter ";

    Finally, print the label
    Label.Print (PrinterName);
    }
    catch (e)
    {
    Alert(e.message || e);
    }
    };
    I'm not sure if this is an APEX or JS question/problem but I hope someone can point me in the right direction.
    
    Regards
      Bas                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    Hi Arie,

    You have me headed in the right direction.
    It seems to me that there is a CR/LF to CR conversion but in the end that did not really matter, I guess.

    I just made a mistake by copying the XML in a database table. What I did the copy on any of the XML string in the code, including the backslash at the end of the line that is JS (continue on a new line) and does not part of the XML... .not too smart of me is it ;)
    Please help out me.

    Problem solved!

    Kind regards
    Bottom

  • Using formCalc or JavaScript

    Good day all.

    I'm now enter in forms that require calculations. In practice some reading I saw where JavaScript and FormCalc are used. Can someone tell me which is better to use?

    Rhetorically, I'm designing, I tried formCalc, but I hit a wee bump. I have UED the following "If(cost_p_h No 0( ) thenSum(60/file_p_h) ' endif" and received the following error "

    Script failed (language formcalc; context is .form1 form [0] of xfa [0] [0]. #subform [0]. #subform [1].) Table 1 [0]. Row1 [0] hard [0])

    script = if (cost_p_h is 0) thenSum(60/file_p_h) endif

    Error: syntax error near 'thenSum' chip on line 1, column 25.

    I am currently in Acrobat 8 Pro and LiveCycle Designer version is 8.05

    Thank you all.

    Chomp

    This is because if files to clear counties that as not equal to 0 is the calculation. Try:

    If (files > 0) then

    Sum(60/Files)

    else $ = «»

    endif

  • FormCalc. vs JavaScript

    What is the main reason for using FormCalc rather than JavaScript?

    is it because users will not have to activate JavaScript in the drive?  only a form of FormCalc will still work regardless of the preferences of the reader?

    Hello

    In fact, this isn't the main reason using FormCalc as opposed to JavaScript,

    FormCalc is not as powerful or as widespread as JavaScript. However, it is ideal for the non-programmers

    who need to add calculations in their forms.  If you come from a background of Microsoft Excel and

    you have no experience with JavaScript, you should consider using FormCalc. FormCalc has a lot

    built-in functions that cover a range of areas, including finance, logic, dates and times, and mathematics.

    FormCalc is supported in the designer, Acrobat, Reader and LiveCycle servers.

    However, it will not work with HTML forms created by LiveCycle Forms.

    While FormCalc is the script language in the designer by default, JavaScript is more

    ideal to create interactive and dynamic forms sophisticated.

    Thank you

    Stéphane.

  • strings in JavaScript question and location

    Hi all

    Not sure that this is right forum for my question... I have when even a few constant strings in my JavaScript files that I have run these scripts from my inDesign plugin in C/C++ code. Anyone know how I can make localization in scripts files (I don't know how support us localization in C / C ++ files).

    TIA,

    MOR

    See "Location ExtendScript strings" in the JavaScript Tools Guide.

  • FormCalc or Javascript equivalent to = now() in Excel

    Is could someone please tell me if there is an equivalent = now() Javascript or Formcalc in Excel? I know there are this time function, but that seems to come out with a number long doen't mean anything for me. I want to be able to tab in a field and the field display the time system present in the format hh: mm.

    Thank you.

    FormCalc is not a little easier?

    $ = Num2Time (Time (), ' Hh: mm ')

  • JavaScript question

    I use Firefox 26.0, and now when I try to connect to Gmail, it shows "JavaScript must be enabled so that you can use Gmail in standard mode. However, it seems that JavaScript is disabled or not supported by your browser. To use standard view, enable JavaScript by changing your browser options, then try again. »

    I went through all the tabs under 'Options', but still can't find a way to solve the problem. Help, please!

    Hello

    In Firefox 23, as part of an effort to simplify the Firefox options define and protect users against unintentially damage their Firefox, the option to disable JavaScript has been removed from the Options of Firefox window.

    However, the ability to disable JavaScript was will not be deleted from Firefox entirely. You can always go to about: config or by installing an add-on.

    Subject: config

    1. In the address bar, type "subject: config" (with no quotes), and then press ENTER.
    2. Click on "I'll be careful, I promise".
    3. In the search bar, search for "javascript.enabled" (with no quotes).
    4. Click with the right button on the result, named "javascript.enabled" and click on "Toggle". JavaScript is currently disabled.

    To re - enable JavaScript, repeat these steps.

    Add - ons

    You can also install an add-on that allows you to disable JavaScript, such as

    • No-Script (to disable JavaScript on a per page basis, as needed)
    • QuickJava (to disable and enable JavaScript, automatic loading of images and other content easily)
    • SettingSanity (add deleted options for JavaScript, JavaScript advanced settings, loading images and the display of the tab bar)

    Thank you and I hope this helps!

  • Please help with javascript question

    Hi all

    So ive got this piece of javascript-

    $("#verse_inscriptions").on ('change', function() {}

    verse of the var = $(this).children("option:selected").val();)

    If (verse! = "0") {}

    $("#textarea").val ($("#textarea").val () + "" + verse);

    calculateTotal();

    }

    });

    This page http://www.milesmemorials.com/product-GH54.html that I need is to adapt it so that it will allow this function to arrive while also inserting the same information into the textarea - here

    < textarea = "textarea2" id = "textarea2" name > < / textarea >

    So basically I have 2 forms, the first is where customers make their choices/selections and the second form retrieves these choices and inserts them in form2 by attributes "onchange", but the piece of code above that from occur (only on this part of the form 'inscriptions and verses' and 'textarea', which, as you can see both are interrelated).

    Can someone help me with this? I appreciate all help.

    Sorry it's my typo (extra '} ')

    $("#verse_inscriptions").on("change", function() {
            var verse = $(this).val();
            if(verse == "0") verse = "";
            $("#textarea, #textarea2").val(verse);
            processTextarea();
    });
    

    --

    Kenneth Kawamoto

    http://www.materiaprima.co.UK/

  • Another image to the random/javascript question

    So I try to find the best way to select the 4 images (out of reach of 8 images) and present them on a page at random. No movement or transitions not needed - just a way every time someone visits the page a random selection of 4 of the 8 images displayed. My current HTML looks like this:

    < div id = "slider" >
    < ul id = "randomSlide" >
    <! - 1 - >
    < li >

    "< a href="path/to/someotherpage.html "> < img alt ="alt text"src="img/1.jpg"/ > < / a >

    < /li >

    .....

    < /ul >

    < / div >

    So any suggestions on how to fix this? The jQuery plug-ins? Advice?

    I have not tested this on a live server, but it works perfectly on the spot. Put the following script immediately before the closing on the page tag:

    
    

    Obviously, you change the values of the src and url in each element of the array.

    What this did that create an array of objects containing the name of the image and its associated url. The table is sorted then randomly, and a loop that runs four times is used to fill the "randomSlide" unordered list, replacing the href and src attributes. I assumed that the images are in a folder called "images". Otherwise, change the value to ' images /' in the loop at the end of the script.

    When I tested it on the spot, I used # for the default href attribute and an empty string for the CBC in each tag. Since some people may have JavaScript disabled, it may be better to use actual values. However, this could change once the page loads images. The problem is that you can not access the unordered list until it has loaded into the DOM. The alternative would be to sort the array and preload the images, but this will slow down the display of the entire page.

    A solution on the server side would be much more effective.

  • JavaScript question calling location.href

    Hello

    I'm calling a function javascript to the click event of a command button.
    function test1() {}

    Alert ("Simple alert");
    Location.href='/context/faces/test';
    Window.Location='/Context/faces/test';

    }

    The redirect does not work the method here. If I Uncomment alert in the method and accept the alert from the rediredirection that happens. Someone tell me the issue here? Is there another way to have the redirect using javascript?

    Thank you
    Bastien

    Yes, that seems correct (I wanted to say in the case of page 2, back to page 1). You use a binding of the ADF, and if so, what are the conditions of discount for the iterators on page 1?

    John

  • JavaScript question for document.domain

    Hello

    How is it when I use 'document.domain' in my JavaScript, the alert no longer works?

    The JS function below, when it is called, the alert does not work:
    function showMessage() {}
    document. Domain = "cfoutput <>#CGI. Server_name #"" < / cfoutput > ";"
    Alert ("Message here");
    }

    Thanks in advance!

    OK sure, here is my tell...















    Display the data in the parent Page:


Maybe you are looking for