To remove a Widget (Instance field) using JavaScript?

Hello

I'm trying to createt a JavaScript Action (sequence) that removes unwanted forms fields, but some fields share the same name. I just want to remove some widgets/instances. I can delete fields with the 'removeField()' function, but it does not work with the widget / instance of a field; all instances of the field are deleted.

For example:

There are two fields on the form. They have the same name, called "address".

So, there are two fields with these identifiers:

address #1

address #2

I would like to delete the first ONLY.

So, I tried the function and it fails:

doc.removeField ("address.1");

I also tried:

doc.removeField ("address #1");

What I'm trying to are not supported or is there another way to do it?

I use Acrobat X Professional on Windows 7.

Thank you.

Thank you. I built a function using the number 1 of the approach. I hope this helps someone else.

function removeFieldInstance(fieldInstanceName) {
     var keepFields = [];

     //Get the value before the last period
     var idPos = fieldInstanceName.lastIndexOf(".");
     var parentFieldName = fieldInstanceName.substring(0,idPos);

     //Go through each instance and get the field properties
     instanceID = 0;
     while(true) {
          var currentInstanceName = parentFieldName+"."+instanceID;

          //Increment the instanceID
          instanceID++;

          //Skip this instance if it is the one we are removing
          if(fieldInstanceName==currentInstanceName) {
               continue;
          }

          //Get the field instance
          var fieldInstance = getField(currentInstanceName);

          //Check if this instance is null (exists)
          if(fieldInstance==null) {
               break; //Stop the loop
          }

          //Get the Rectangle, Page Number, Field Type properties
          var fieldName = parentFieldName;
          var fieldType = fieldInstance.type;
          var fieldPage = fieldInstance.page;
          var fieldRect = fieldInstance.rect;

          //Add the properties to an array
          var keepField = [];
          keepField[0] = fieldName;
          keepField[1] = fieldType;
          keepField[2] = fieldPage;
          keepField[3] = fieldRect;

          //Add the field array to the keepFields array
          keepFields.push(keepField);
     }

     //Remove all the field instances
     removeField(parentFieldName);

     //Create all the fields
     for(var i=0; i 
         

Tags: Acrobat

Similar Questions

  • try to concatenate address below fields using javascript

    try to concatenate address below fields using javascript

    this.rawValue = xfa.resolveNode ("#subform [1]..") RawValue CAOName") +"\n"+ xfa.resolveNode (" #subform [1]. ") Addr1") .rawValue | « \n »

      if((xfa.resolveNode("#subform[1].Addr2").rawValue)!= null)
      {
      xfa.resolveNode("#subform[1].Addr2").rawValue}
      else
      {xfa.resolveNode("#subform[1].City").rawValue||xfa.resolveNode("#subform[1].State").rawValue||xfa.resolveNode("#subform[1].Replyzip").rawValue

    but only the name and the addr1 print, can someone help me fix my script... Thank you

    DE1209

    Try something like this:

    this.rawValue = xfa.resolveNode("#subform[1].CAOName").rawValue + "\n" + xfa.resolveNode("#subform[1].Addr1").rawValue + "\n";
    if ((xfa.resolveNode("#subform[1].Addr2").rawValue) != null) {
        this.rawValue = this.rawValue + xfa.resolveNode("#subform[1].Addr2").rawValue;
    } else {
        this.rawValue = this.rawValue + xfa.resolveNode("#subform[1].City").rawValue + xfa.resolveNode("#subform[1].State").rawValue + xfa.resolveNode("#subform[1].Replyzip").rawValue
    }
    
  • PDF forms: extraction of data fields using javascript

    Hi, I was wondering if someone could help me...

    I have created a PDF form which, once the user fills out the fields, he or she will click on a button to send the form by e-mail to their Manager. Once the registration form is authorized by the Director, the Manager will be click on another button, which will forward the form to the original user. The user would have filled their email address in one of the fields in the form. Is it possible to extract data from the field e-mail address using javascript?

    Thank you very much!

    You would have to do something like this:

    // Get the email addresses
    var email1 = getField("email1").valueAsString;
    var email2 = getField("email2").valueAsString;
    
    // Send the email
    try {
        mailDoc({
            bUI: false,
            cTo: email_addr1 + ";" + email_addr2,
            cSubject: "The subject of the mail",
            cMsg: "The message body of the email"
        });
    } catch(e) {
        app.alert("Could not send email, sorry.", 1);
    }
    

    Note that the e-mail addresses must be separated by a semicolon, as shown. Also, affecting false bUI will only work if the code is run form a privileged context, as in a JavaScript file to the folder level.

    If you want to hard-code one of the e-mail addresses, it would look like:

            cTo: email_addr1 + ";[email protected]",
    
  • Change the label of text form field using javascript.

    Hi all, need your help.

    I have a field that will provide different information depending on the type of document.

    I would like to change the label of the field of javascript in da

    Thank you very much

    Andrei

    You can always set the page element and follow the following to refresh a specific region

    APEX Oracle report update the easy way & laquo; Warp11. ::. Group knowledge Oracle Apex

    Check the following for an option in jquery

    change the text on the label based on toggle? -jQuery Forum

    jQuery - label text change based on radio click - Stack Overflow

    Kind regards

    Vishal

    Oracle APEX 4.2 reports | Packt Publishing

    Vishal blog

  • Remove the Script level Document using JavaScript?

    Hi all.

    Is it possible for a document-level script to delete itself? I am running Adobe Acrobat Professional 11.

    My situation is that I'm currently analysis data using a Java application. The taylors Java application a script based on each specific PDF and then inserts it into the PDF file automatically. When the PDF file is opened, the script runs once and then is no longer necessary.

    Because the script is no longer required, it would be preferable if the script could be deleted automatically. Is it possible that the script has access to the field in which it is stored (for example, doc.javascriptField = "" ;)?) Or by some miracle, a remove function already exists?

    I think that the lack of need for such function by General and advanced users I won't get it the answer I hope. But it's worth a shot. Meanwhile, I am inserting a flag in the field keyword so that the script does not run twice. It works, but it is not really clean.

    Any help would be greatly appreciated.

    Thank you

    Jonny O

    Use this code:

    this.removeScript ("ScriptName");

  • How to validate the field "Reason for change" in the commercial indications using JavaScript?

    How to validate the field "reason for change" in the commercial directions Summary tab using JavaScript?

    Current version of PLM4P: v6.1.1.5.2

    Please help me to validate the fields using JavaScript.

    Thank you

    Nefertari

    Developed using some of the Javascript predefined functions that we offer, it's just JavaScript and jQuery.

    But here is an example.

    (Use Internet Explorer F12 developer tools to find the IDS of the fields to work with.)

    $(document).ready(function() { 
    
        if (UI_Ext_isSpecInEditMode && UI_Ext_HasWorkflowBehavior('1005'))
        {
           //normally, we can use jquery to retrieve elements ($('#ifOfInput).val()), but it seems to fail when the id and the name attributes are the same. so we just use javascript document.getElementById instead.
           var reasonForChange = document.getElementById('ctl01$SpecSummaryctl1$ctlCollapsibleContentContainer$ctl00$txtChangeReason')
    
           if (reasonForChange != null) { 
    
                if (reasonForChange.value == null || reasonForChange.value.length == 0) {
                     UI_Ext_MarkFieldAsRequired('ctl01_SpecSummaryctl1_ctlCollapsibleContentContainer_ctl00_lblSpecSummaryReasonforChange');
                     alert('Reason For Change is required');
                }
           }
        }
    }); 
    

    However, not the user registration or workflow specification. If you were to do this, you must remove record them and workflow buttons and links, and this probably isn't the best practice. On the contrary, you would write validation server that would give you this error message if they try to save/workflow. (So most customers do not use Extensions of the user interface for this type of validation).

    Kind regards

    Ron

  • Test for the day of the week, using javascript?

    Is it possible to test for what day of the week has been selected in a Date field using javascript?

    I have a script that checks if an option button 'Day' is checked and if so throws an error if the input time is not between 06:00 and 15:30. I need to change the hours between 06:00 and 14:30, but only if the day of the week is a Friday (selected in the field 'Date').

    Any ideas would be really appreciated.

    If

    (TimeReceived.isNull == true()

    {

    xfa.host.messageBox ("Please enter a time received");

    TimeReceived.rawValue

    = null;

    xfa.host.setFocus ("TimeReceived");

    }

    else If ((TimeofCall.Day.rawValue ==0))

    {

              if (TimeReceived.rawValue.search(":") > 0)

                        val1 = TimeReceived.rawValue.replace (":", "");

    on the other

                        val1 = TimeReceived.rawValue;

              if (val1 < 600 || val1 > 1530)

    {

    xfa.host.messageBox ("If 'Airtime' has selected day, the"received time"must be included in the normal working hours (06:00 to 15:30).") Make sure that you use military time, please re-enter. ») ;

    TimeReceived.rawValue

    = null;

    xfa.host.setFocus ("TimeReceived");
    }
    }

    FormCalc has a date function to obtain the day of the week.

    Form1.Page1.Subform1.DayOfWeek::calculate - (FormCalc, client)

    date_ var = Date2Num(date.formattedValue,"MM/DD/YYYY")
    $ = Num2Date (date_, "EEE")

    The "EEE" model returns MON, Mar, sea, etcetera. You must synchronize the date pattern on the DateTimeField ('date' in my case) with the script.

    "dayOfTheWeek" could be a hidden field and you can reference the 'dayOfTheWeek.rawValue' of your JavaScript.

    Steve

  • Certificate encryption using JavaScript

    All the:

    I'm encryption of the documents using a certificate.  This code works exect that restrictions of the document are not being employed.

    After that the code is executed, any restrictions on the document (Document properties-> Security-> Document Summary of Restriction) are "allowed".  When you click "Edit settings", the security certificate settings window appears.  After clicking on 'Next', the Group of Permissions box has all the correct permissions. HOWEVER, when you click on "Permissions."... "the box" Restrict printing and editing the document and its security settings "is not checked.  After you check the box 'limit printing... '. "and saving the document (notice no other settings have been chaged), the permissions are removed.

    How to use JavaScript to "restrict printing / editing the document and its security settings?

    var curDoc = this;
    
    var certPath = "/C/Documents and Settings/rrh/Desktop/Sample/";
    var cliCertFile = "CertFile.cer";
    
    var cliCert = security.importFromFile({cType:"Certificate", cDIPath:certPath + cliCertFile});
    
    var cliEntity = [{defaultEncryptCert:cliCert}];
    
    var cliPermissions = 
    {
        allowAll: false,
        allowAccessibility: false,
        allowContentExtraction: false,
        allowChanges: "none",
        allowPrinting: "lowQuality"
    };
    
    curDoc.encryptForRecipients(
    {
        oGroups:
        [
            {userEntities: cliEntity, permissions: cliPermissions}
        ],
        bMetaData:true,
    });
    
    

    Special Kudos to Patrick, who helped with the certification of document in JS.

    Oh!

    Glad that you have work and thanks for posting of the code - I know not that it will be beneficial for someone else down the line!

  • Using the variable obtained using JavaScript in a widget

    Hi again

    I found this useful bit of JavaScript code that gets the name of active users of an LMS and sets it to a variable in a Captivate course.  [the link below for anyone interested]
    I have seen that variables can be used in the Widgets but I can't make it work.

    I have defined the variable as ActiveUserName ($$ActiveUserName$ $ in list dropdown widget) but it shows that $$ActiveUserName$ $ if I'm the test or on a LMS System.  Same result with an entry box.

    Someone has already tried this before or know a way to do this please?

    Thank you

    As promised, the JavaScript link on behalf of active users of traction: display name of your LMS using Adobe Captivate to the 6.x - CaptivateDev.com student

    Captivate 7 and 8, the Captivate defined variable user cpQuizInfoStudentName made for you.

    With regard to the drop-down list widget, you cannot use a variable in the comma delimited list to display to the user. The result when the user makes a selection in the list can be assigned to a variable.

  • the use of exceptions to differentiate static/instance fields

    I want to identify the instance fields of a class I know nothing about.
    This example does this:
    public class Main {
      public static void main(String args[]) {
        test();
      }
    
      static void test() {
        try {
          Field[] fields = Foo.class.getFields();
          for(int i = 0; i < fields.length; i++) {
            System.out.print(fields.getName());

    try {
    fields[i].get(null);
    } catch(NullPointerException e) {
    System.out.println(" <-- instance");
    continue;
    }
    System.out.println(" <-- static");
    }
    } catch(Exception e) {
    e.printStackTrace();
    }
    }

    static class Foo {
    public static int staticInt = 5;
    public static String staticString = "five";

    public int instInt = 10;
    public String instString = "ten";
    }
    }
    I am using NullPointerException throwing to control the flow of my method. I am sure a good programmer would never do this, right?
    So, is there any other way to determine if a field is a class's instance, or static, field?
    thank you.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    http://download.Oracle.com/javase/6/docs/API/Java/lang/class.html#getModifiers)

  • Field of necessary game using javascript

    Hello world

    I am looking for a method to set a field of javascript needed inside. i.e.

    If (this.rawValue == 1)

    {ConditionalField.Setattribute = required}

    on the other

    {

    ConditionalField Setattribut = optional

    }

    Thanks for your help

    Concerning

    Meir

    I don't see a script dedicated to LiveCycle forum, so I'll ask you repost in the formum do you think is more appropriate there.

  • To access the objects in array form using javascript

    I hope, it's a simple question that I've been beating my head on the days...

    I have a form with several fields of the same name--let's call it the recordedHours of fields.

    Adobe assign an index for each instance of the field, so we will have to recordedHours [0], recordedHours [1]... recordedHours [30]

    Now, I need to set and get the values using Javascript, so something like:

    for (i = 0; i < = 30; i ++)

    {

    var h = this.recordedHours [i] .rawValue;

    }

    It does not work. Or don't complete a reference: form1.timeform.recordedHours [i] .rawValue

    or getElement: this.getElement ("recordedHours", i)

    or the dotted notation: form1.timeform ["recordedHours"].i.rawValue (syntax error, as I have, when converted to digital gives an illegal element/object identifier)

    I tried all the ways I see maybe get and set values through Javascript and I've searched high and low on the web but couldn't find anything - I know I have probably SUS (the stupid user Syndrome), but can someone help me out here?

    See you soon,.

    Marty.

    The problem is that you have to solve the expression to be able to get the right index finger, you can use the xfa.resolveNode syntax. This allows you to pass a string and that gets interpreted for you. So the syntax:

    for (i = 0; i<>

    var h = xfa.resolveNode ("form1. ("Page1.recordedHours [" + i + "']") .rawValue

    }

    Hope that helps

    Paul

  • How to use Javascript to loop through a tabular presentation

    APEX: 4.2.3

    DB: 11 GR 2

    Requirement:

    I have a master form / retail. We will see that master is the order information; Detail is the order lines. Detailed form is tabular

    The detailed form, there is an attribute called 'Line Order Qty' and the user can update this field.

    User can update all rows in the detail forms and change "line Order Qty' for each line. When the user click on 'Save' button on Master form, I have to do below:

    Sum of the 'line Order Qty' for all lines, and compare it to another field called 'Plan Order Qty' on the master shape.

    If sum 'Line Order Qty' > "Plan Order Qty", then it should appear a message with "Are you sure?" with two buttons on the message: OK and cancel.

    If users click on 'OK', the application will proceed and update another field called 'Sum of Order Qty' on the main form and the value set for the sum of "Online Order Qty" for all lines;

    If the user clikc 'Cancel', the application will be paused. The user must come back to change "Line Order Qty", and then try again

    given, I need a popup message when the validation, I think I have to write javascript; However, in the javascript code, I need complete all lines in detail (tabular form) to get the

    The sum of the 'line Order Qty'. Then I can compare the value and to launch the pop message if validation has failed?

    By reading this thread: building the perfect beast: Oracle APEX - Soft Validation using dynamic measurements

    I think I need to create a reference for action (DA) dymaic Javascript expression; However, in Javascript, how do I browse a table?

    Yet once, I need an example of using Javascript to browse tabular forms in the form master / detail.

    I don't know that my question should be raised before; but I can't find a good match of thread.

    Thank you!

    Kevin

    Hi Kevin Zhang,

    Sum of the 'line Order Qty' for all lines, and compare it to another field called 'Plan Order Qty' on the master shape.

    If sum 'Line Order Qty' > "Plan Order Qty", then it should appear a message with "Are you sure?" with two buttons on the message: OK and cancel.

    If users click on 'OK', the application will proceed and update another field called 'Sum of Order Qty' on the main form and the value set for the sum of "Online Order Qty" for all lines;

    If the user clikc 'Cancel', the application will be paused. The user must come back to change "Line Order Qty", and then try again

    given, I need a popup message when the validation, I think I have to write javascript; However, in the javascript code, I need complete all lines in detail (tabular form) to get the

    The sum of the 'line Order Qty'. Then I can compare the value and to launch the pop message if validation has failed?

    Follow the steps below

    Step 1: Change your page - > function and declaration of the Global Variable-> to insert the code below

    (i) f06 is here, the column on which I am looping the f06 column and enters the total variable to the value change in the values of the row that is changed by the user.

    (II) also replace your column with f06 markup on which you want to loop and calculate the total

    (III) assuming that P6_ITEM is the point where you plan_order_qty, replace with your article.

    (IV) SAVE this demand is what happens when OK is clicked, assign the request to process.which you give the floor to a click of the button SAVE the

    function update_order_qty () {
      var line_order_qty_tot = 0;
      $("input[name='f06']").each(function() {
        line_order_qty_tot += parseFloat($(this).val().replace(/,/g,''))||0;
      });
    
      var plan_order_qty = apex.item( "P6_ITEM" ).getValue()
    
      if (line_order_qty_tot > plan_order_qty) {
          apex.confirm('Are you sure?', 'SAVE');
      } else {
          apex.submit( 'SAVE' );
      }
    }
    

    Step 2: Edit the page-> Execute when loading the page-> to insert the code below

    \\calculate the total on change
       $("input[name='f06']").change(function(){update_order_qt();})
    

    Step 3: Change your button Save and put under the Action when the button is clicked

    Action: Redirect URL

    Target URL:

    javascript:update_order_qty();
    

    Hope this helps you,

    Kind regards

    Jitendra

  • APEX DA validation using javascript

    Hello

    APEX 4.2 using (Oracle, 10 anf 11g)

    I have a page and check off the items when click on the button "SUBMIT" using Javascript.

    for example.  I have a 10 page. P10_item1, P10_item2, P10_item3 so on. name of the button is SUBMIT.

    Dynamic action: Click-> button-> action-> execute Javascript code

    If ($x('P10_item1').value == "| $x('P10_item2').value ==" | $x('P10_item3').value == ") {}

    Alert ('required fields can be left blank');

    }

    else {}

    Apex. Submit ('SUBMIT');

    }

    ALL WORK fine, but I want to add the change of background color (field) if any field above is empty after

    Click on submit. I added these to the CSS page

    . Highlight-error

    {

    background-color: #FAE7E7! important;

    color: white;

    }

    so, how can I use this css in my javascript code after warning message please?

    Thank you very much.

    Kind regards

    RI

    Hi RI,

    (1) put that css for you have created for normal in background

    Page-> css-> online

    .highlight-ok
      {
      background-color: none !important;
      color: white;
      }
    

    (2) check the else part

    if ($x('P10_item1').value == '') { 
    
            $("#P10_item1").addClass('highlight-error'); 
    
            alert('Mandatory fields can be left blank'); 
    
        } else if ($x('P10_item2').value == '') { 
    
            $("#P10_item2").addClass('highlight-error'); 
    
            alert('Mandatory fields can be left blank'); 
    
        } else if ($x('P10_item3').value == '') { 
    
            $("#P10_item3").addClass('highlight-error'); 
    
            alert('Mandatory fields can be left blank');
        } else {
            $("#P10_item1").addClass('highlight-ok');
            $("#P10_item2").addClass('highlight-ok');
            $("#P10_item3").addClass('highlight-ok');
            apex.submit('SUBMIT'); 
    
        }
    

    Hope this helps,

    Kind regards

    Jitendra

  • Pop - up using javascript in dynamics of the Actions

    Hi all

    Before you begin with the question, I want to share the below of the details on the application

    Table creation script

    create table status_dashboard (ID number, name varchar2 (10), varchar2 (10) State, varchar2 (1000)) URL;

    Insert the script

    insert into status_dashboard values 1, 'A1', 'up', 'www.ibm.com';

    insert into status_dashboard values 1, 'B1', 'up', 'www.hp.com';

    "insert into status_dashboard values 1, 'C1', 'up', ' www.msn.com";

    insert into status_dashboard values (1, "D1", "low", "www.yahoo.com'");

    insert into status_dashboard values 1, 'E1', 'up', 'www.oracle.com';

    insert into status_dashboard values 1, 'F1', 'up', 'www.facebook.com';

    insert into status_dashboard values (1, 'G1', 'down', 'www.twitter.com');

    "insert into status_dashboard values 1, 'H1', 'up', ' www.google.com ';

    insert into status_dashboard values 1, 'I1', 'up', 'www.apex.oracle.com';

    Report query

    SELECT max (case when mod (rn, 3) = 1 then end name) col1

    , max (case when mod (rn, 3) = 2 then end name) col2

    , max (case when mod (rn, 3) = 0 then end name) col3

    , max (case when mod (rn, 3) = 1 then decode (status, 'down', 'red', 'green') end) The_color1

    , max (case when mod (rn, 3) = 2 decode (status, 'down', 'red', 'green') then end) The_color2

    , max (case when mod (rn, 3) = 0 then decode (status, 'down', 'red', 'green') end) The_color3

    , ceil ((rn) / 3)

    (select name, status, row_number() on rn (order by name) of status_dashboard)

    Group by ceil ((rn) / 3)

    order by ceil ((rn) / 3)

    Report link on Oracle Apex

    https://Apex.Oracle.com/pls/Apex/f?p=54850:1

    I created a matrix report, enabled the conditional formatting. The only problem I have right now is to go to a link in the report.

    I use 3 text elements Apex - P1_ID, P1_NAME and P1_URL.

    I use also 3 dynamic actions

    1. DEFINE NAME - will set the P1_NAME field with the value clicked in the report.

    2 SET ID & URL - define the fields P1_ID and P1_URL of the DB using the P1_NAME field.

    3-pop-up-appears the P1_URL using javascript.

    Problem statement:

    The pop up page is a blank page, although I can see that the value for the P1_URL field is defined using dynamic measurements.

    Could someone please take a look at this example and help me with the same.

    PS: The example was developed using sample data.

    Hello

    When you use the substitution in JavaScript string, the value is used when page and is pretty hard-coded in the document value.

    Even if you change the value of the element or the element value in session state, it will not happen to the HTML document.

    In dynamic action, try something like

    popupURL($v("P1_URL"))
    

    Who will choose the value of the item and pass it to the popupURL function.

    Yes, you have created, sample, but how we can view source if we are unable to connect your workspace?

    Kind regards

    Jari

Maybe you are looking for

  • OfficeJet 7310 all-in-one: HP Solution Center software

    I use "HP solutions Center" scan on my 7310 all-in-in-one software. I have upgraded to Windows 10 & it worked just fine. I just got the latest update of Windows-10 last week. Now, HP Solution Center does not open. When I click on the desktop icon I g

  • Connection is disconnecting remote desktop continues

    Hi team, I am facing a problem with the remote desktop connection is disconnected several times. We are having the same problem with 3-4 machines. Those are all machine have a system of operating windows XP SP3 as updated antivirus. All but a few min

  • HP Pro 3500 - why restore Windows 8 CDs?

    I bought this PC (C9J26UT #ABA) of Tiger Direct and it has Windows 7 Professional but the restore CD are Windows 8. Why is this? According to me, they told me he was eligible for a free update for Win8, but I have no idea how to do that.

  • Collision in identities

    "The operation failed: these devices {name of a single camera} have a collision in the identities."  If one of the devices of collision is a camera, please check pending devices as well. » This is the text of an error message received when installing

  • Installation of Windows 7 doesn't recognize Seagate ST3500418AS

    Installation of Windows 7 does not recognize the hard drive. When I get to the step of the installation where he asks "which type of installation do you want" and I click on custom, it does not include the hard drive on the list. If I click on "Advan