Accesing XFA data with javascript

Hello everyone:

I'm starting to develop pdf with LiveCycle Forms and I find a few problems getting the document info on author, file name, path, etc. with javascript. I read some books, but I can't find where to get this value. I tried xfa.datasets..., xfa.host..., xfa.form... without success.

Any suggestions?

Thanks for your time!

Kind regards

Javier

Hello

Here is an example show how to access the file name and path (don't worry the button): https://acrobat.com/#d=ZnxO-dlXXFDS0GvYcQk2NQ

You can access the metadata, the properties of the form, but I need to dig up a script. Perhaps a search on the forum.

Hope that helps,

Niall

Ensure the dynamics

Tags: Adobe LiveCycle

Similar Questions

  • How to interact xfa attribute with javaScript

    I want to change the text with a font in bold in javaScript. How can I update < p > with an attribute required in javaScript?

    < draw x = '9.525 mm' y = '69,85 mm' minH '5.08 mm' = >

    < character = "Verdana" size = "9pt" / >

    < value >

    < exData contentType = "text/html" >

    " < body xmlns =" http://www.w3.org/1999/xhtml "xmlns:xfa =" " http://www.XFA.org/schema/XFA-data/1.0/ ' > < style p = "text-decoration: none;". "letter-spacing: 0 in" > Kredia you perdoret nga < span style = "xfa - spacerun:yes" > < / span > < span style = "make weight:" BOLD "" > Kredimarresi < span style = "xfa - spacerun:yes" > </span > < / span > by < /p > < / body >

    < / exData >

    < / value >

    < ui >

    < textEdit / >

    < /UI >

    < leftInset margin = "0.5 mm" rightInset = "0.5 mm" topInset = "0.5 mm" bottomInset = "0.5 mm" / >

    < para vAlign = "middle" / >

    < / draw >

    Hello

    You can make a few simple changes using objects span, so;

    spans var = [];

    spans.push ({text: "Kredia you perdoret nga"});

    spans.push ({text: "Kredimarresi", fontWeight:700});})

    spans.push ({text: 'by'});

    xHTML var = util.spansToXML (spans);

    Text1.value.exData.LoadXml (xHTML, false, true);

    Give something similar to your sample.

    There are a few other examples Adobe LiveCycle Designer by BR001 Cookbooks: xmlToSpans but if you want to use one of the attributes that the span object does not support, you can try to use E4X (XML for JavaScript extension) and an example of this is Adobe LiveCycle Designer by BR001 Cookbooks: adding values in a form to an email

    Concerning

    Bruce

  • Linking the data with JavaScript for PDF link merge field

    Hi all

    In InDesign, I use the data merge to generate a PDF file with data from a data source file. The fusion of data will fill a product ID field. I want to write a script that changes the product number field so that it contains a JavaScript link in the PDF file.


    For example, the number of the product [1234-567] will launch: app.launchURL ("plsddr://localhost/1234-567 |") * "(, true);" When the product number link is clicked on in the PDF file.

    Can anyone provide an example of how this could be done, or point me in the right direction? If there is a better way to go about it, please let me know.

    Thank you!

    What findText returns is a list of text, but it is completely interchangeable with the word. It seems that InDesign can change at will between the characters, words, lines, paragraphs, and stories.

    Text can consist of a single SpecialCharacter (a column break, or a return or one of the SpecialCharacters enumeration) or a "String" standard JavaScript object - a simple Unicode string.

    The property that "holds" the text is 'content' - so, it all adds to 'get' the text that has been found, you will use generally

    Next = list.pop ();

    Alert ("the text content of this is"' + next.contents +' "'");

    and you can build further on it - use it as a URL HyperlinkDestination or something like that. The fixed points of point-'next' - text 'live', it was found in, so be careful not to change. Do something like

    Next.contents = "hey what happened."

    will change the text in your document. But it is also useful to add, for example, a hyperlink to the actual position on this text has been found.

    (A Council about the changes: you want to change your document, the original findText elements stressed will be ruined once you changed one!) To avoid this, work backwards from the last element found at the first. findText (true) reverses the order of the found items, from the last to the first - see JS help on that).

    Regarding

    (Also, how to print the contents of a Word object?)

    It depends on what you mean by "printing". On a printer?

  • An index by programming to date with JavaScript

    Hi all

    I got a clue from book and I use JavaScript code to change the sort order of topics. When I did change the topics, I want to update the index of JavaScript. Is it possible to do? Thanks in advance.

    Rick Quatro

    Rick at frameexpert dot com

    585-659-8267.

    Ah, you're right. In this case, I think you can use myIndex.generate () - all of the arguments are optional, so if you leave them out, I think that it just re - generate the existing index.

    Dave

  • Is it possible with javascript to compile the data entered by the user in an easy format to excel?

    I have a form in which the user enters several lines of data as well as additional information on these data.  I would like finally to export data, so I can manipulate the Excel.  This is possible because javascript (or otherwise)?  Here is an example of what I mean.

    The form of a table in which the user enters each of the names of his friend, their favorite color and their age.  I want the name of the specific friend linked to their favorite color and age so when I export to excel I can see how many friends has the user whose favorite color is red.

    If the form data would be as follows:

    Friend1name

    Friend2name

    Friend3name

    Friend1color

    Friend2color

    Friend3color

    Friend1age

    Friend2age

    Friend3age

    When I export the data as entered above, the results of each field in another column.

    Anyone has any ideas for that?

    It is possible with JavaScript. You can write the data to the JavaScript console and then copy & paste into Excel, or write to a file as an attachment (aka data object) and export it. Here's a sample script that writes the field data in the JavaScript console:

    Table of domain names

    Invoke the var = ['Friend1name', 'Friend2name', 'Friend3name', 'Friend1color', 'Friend2color', 'Friend3color', 'Friend1age', 'Friend2age', 'Friend3age'];

    Browse the fields and write the field values in the console

    for (var i = 0; i)< afields.length;="" i="" +="1)">

    Console.println (getField(aFields[i]).valueAsString);

    }

    Display console

    Console.Show ();

    You can place this code in the mouse event to the top of a button and click the button to run it. This last line of code displays the console and you will be able to copy & paste the data.

  • Dynamic action for validation of date with the notification message plugin

    Hi all

    Someone help me please with dynamic action for validation of date with the message notification plugin. I have a form with two elements of the date picker control and message notification plugin.

    The requirement first user selects the exam is finished and then selects the date. So, if the date is greater than the date of the examination is over + 2 years then doesn't trigger the message notification plugin. I tried to create that dynamic action on the date picker date that triggers the scheduled issue notification message but I want to make conditional, I mean displays the message only if date of the selected is greater than the date of the exam is finished more than 2 years.

    In terms simple, notification is displayed only if provided is superior to (date of the exam is completed + 2 years).

    I use oracle apex 4.0 version and oracle 10g r2 database. I tried to reproduce the same requirement in my personal workspace. Here are the details. Please take a look.

    Workspace: raghu_workspace

    username: orton607

    password: orton607

    APP # 72193

    PG # 1

    Any help is appreciated.

    Thanks in advance.

    Orton.

    You can get the value of the date of entry:

    $(ele) .datePicker ('getDate');

    So what to add functions such as:

    function validateNotification (d1, d2) {}

    Date1 var = $(d1) .datepicker ('getDate');

    date2 var = $(d2) .datepicker ('getDate');

    if(date1 && date2) {}

    return ((date2.getTime()-date1.getTime())/(1000*24*60*60))>(365*2);

    } else {}

    Returns false;

    }

    }

    The logic based on setting (I have two years from years of 365 days preceding)

    Then in the D.A. specify a JavaScript expression as:

    validateNotification ('P2_REVIEW_COMPLETED', this.triggeringElement.id)

    Refer to page 2 for example.

  • How to fill a field of date with today's date when the signature field is signed?

    How to fill a field of date with today's date when the signature field is signed? In the LCD, I insert a signature field and a date field, what parameters in these two fields are necessary to make this work? Is the date field, the value calculated? I tried different JS suggestions I found, but none work. In the form, I named the signature ClaimSignature field and the date in the ClaimSigDate field.

    The thought of her with a little help. In the script editor window, I selected the postSign event and added the following JS:

    Form1.Page1.ClaimSignature::postSign - (JavaScript, client)

    var date = new Date();

    var day = date.getDate ();

    var month = date.getMonth () + 1;

    var monthstring = (month, 10?) ('0' + month: month)

    year var = date.getFullYear ();

    var = year DateString + '-' + monthString + '-' + (day< 10="" "0"="" +="" day="" :="">

    ClsimSigDate.rawValue = dateString;

    I hope this helps someone else save time.

  • Alternate slides with JavaScript (or advanced Actions)?

    I was wondering if someone out there with the knowledge of JavaScript could help me a little...

    A colleague came to me with a question about randomization of the slides. We work in Captivate 5.5. The slides are all part of a quiz (but aren't question slides). They have a click box. The idea is that if the user clicks on the box (or off the beaten track), it shows a good (or bad) legend and then jumps to a random slide (new). If the user manages at the end of the slide without selecting anything, their time is running out and they get fried to a random slide and it is regarded as an incorrect answer. The user should see all of the slides in random order, with no recurrence.

    I created a tip Action, integrating the widget of random number, and it works. My problem is that the project has 50 blades, and I'm not sure it is very feasible with advanced Actions. As it is, my test with 3 random slides is an action with 4 conditional statements, so I'm not really looking to create one for 50 slides. (I don't know even if Captivate would be able to handle this).

    Is there a way (judging) to achieve with JavaScript instead? My vague idea based on my very limited knowledge of programming is:

    1. on enter first Captivate slide, create the array of random slides - 1 slide numbers (because cpCmndGotoSlide index starts at 0)
      so if I had a project where I wanted to shoot random slides 3-8, the would be [2, 3, 4, 5, 6, 7]
    2. Shuffle/random table
    3. set up a variable called slideviews = 0 to keep track of how many slides have been seen (and so which item in the table to move to the next randomly)
    4. Create a function that I'm going to run when I want to access a random slide (whether at the end of a slide or in the success or failure of a click on a square)
      something like... If slideviews < array.length, cpCmndGotoSlide = array [slideviews]; slideviews ++; Another thing, cpCmndGotoSlide is 8 (jump at the end of the slides)

    Of course, this lack of things (like the proper syntax and things needed to communicate with captivate)... but is sound logic? Is there a better way to do it?

    Come to think of it, the table and the slideviews variable should be saved if we wanted it works with bookmarking... I think that this project will be SCORM 1.2 LMS System.

    It would be nice to have a variable user I can access within the Captivate project and I can put in a legend to show the script #. Something like scenario = slideviews (I know that's not the syntax, reading series of JavaScript of Jim Leichliter on CaptivateDev.com, but that's the basic idea.)

    Anyway, pointers would be very useful! Thank you.

    Edit: I played a little bit; for randomization, I found a code online, and then I wrote something that automatically creates a table and a function for the jump to a slide randomly. Here's what I have so far (not tested in Captivate yet):

    var objCP = document.Captivate;
    
    var randomNumbers = []; 
    
     // The following creates the values for the array: 3 to 52.
     // I want to randomize slides 4-53, using cpCmndGotoSlide (index starting at 0) to jump to them
    
    for(i=3; i<53; i++) {
                        randomNumbers[i-3] = i;
    }
    
    var n = randomNumbers.length;
      var tempArr = [];
      for (i = 0; i < n-1; i++ ) {
        // The following line removes one random element from arr
        // and pushes it onto tempArr
        tempArr.push(randomNumbers.splice(Math.floor(Math.random()*randomNumbers.length),1)[0]);
      }
      // Push the remaining item onto tempArr
      tempArr.push(randomNumbers[0]);
      randomNumbers=tempArr;
    
    var slideViews = 0;
    
    var randomSlide = function() {
    if (slideViews < 50) {
                        objCP.cpEISetValue("cpCmndGotoSlide", randomNumbers[slideViews]);
                        slideViews++;
                        objCP.cpEISetValue("scenarioNumber", slideViews);
              }
              //after all the slides have been seen, jump to the final results slide
              else {
                        objCP.cpEISetValue("cpCmndGotoSlide", 53);
              }
    };
    

    I doubt it will work off the bat, but maybe this is a beginning?

    I managed to get things working, so I thought I'd post my (probably a little unwieldy and inefficient) code in case people come across this thread and want a starting point:

    var objCP = document. Captivate;
    var randomNumbers = [];
    var slideViews = 0;
    CVS var = 0;

    shuffle var = {function (array)}
    var m = array.length, t, j;
    so that {(m)
    j = Math.floor (Math.random () * m-);
    t = array [m];
    table [m] = array [j];


    table [j] = t;
    }
    };

    var jumpSlide = function() {}
    If (slideViews < randomNumbers.length) {}
    objCP.cpEISetValue ('cpCmndGotoSlide', randomNumbers [slideViews]-1);
    slideViews ++;
    objCP.cpEISetValue ('scenarioNumber', slideViews);
    }
    else {}
    objCP.cpEISetValue ('cpCmndGotoSlide', 52);
    }
    };

    var randomSlide = function() {}
    If (g_objAPI.LMSGetValue ('cmi.comments') = ") {}
    for (i = 3; i < 53; i ++) {}
    randomNumbers [i-3] = i;
    }
    Shuffle (randomNumbers);
    g_objAPI.LMSSetValue ('cmi.comments', randomNumbers);
    resume ++;
    jumpSlide();
    }
    ElseIf (resume = 0) {}
    randomNumbers = g_objAPI.LMSGetValue('cmi.comments').split(',');
    slideViews = objCP.cpEIGetValue ('scenarioNumber');
    resume ++;
    jumpSlide();
    }
    else {}
    jumpSlide();
    }
    };

    The random slide order is stored in cmi.comments, and the position in the sequence is stored in a Captivate variable called scenarioNumber. I could have stored the two variables of Captivate in cmi.suspend_data, but in the end, I liked being able to see the numbers when considering the SCORM data. To work around problems with initialization, I made the creation/restoration of the part of random numbers of the function which climbs to a slide randomly, so nothing is actually executed when entering the first slide.

  • How to paste into the text field of the Clipboard with JavaScript?

    I implement the following actions in the form of javascript:

    1. a user clicks on a link on the PDF to open a web page

    2. the user uses the web page to find information and then copy text from the web page

    3. the user clicks a button on the pdf form and it formats the text to the Clipboard and paste them into the text fields.

    I can't find any references for the reading of the data from the Clipboard with javascript in PDF Forms. is it not possible?

    Perhaps 'not possible' was a little too hard. It would be a security hole if she accepts a script in a form to copy the contents of the Clipboard without the user explicitly allowing it. It has been possible to copy the contents of the Clipboard into a form field using the app.execMenuItem method without the user knowing / allowing it, but that hole was closed. The restriction can be overcome, as explained in the documentation: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.143.html

  • Add a watermark with fields with JavaScript / c#

    I want to add a watermark with JS method addWatermarkFromFile. The watermak is a PDF file that has fields where I can enter some information (user name, date, time, for example) and save it in the file watermak. If I use the Add Watermak in Acrobat X window, the contents of the fields appears in the watermark on the files. However, if I use JS this.addWatermarkFromFile (...) (that this either with all the parameters of seizures, or simply use a para the full path of the file watermark), watermak can be added, but the fields are completely absent. What I miss in JS? Thank you.

    PS please don't tell me to use the dynamic buffer. All this will be done in c# finnally. Custom dynamic stamp does not work with c# as I expected.

    Yes, addWatermarkfromFile will not focus on the fields.

    That's why I recommend making TWO DISTINCT operations.

    (1) stamp in the main parts of PDF

    (2) the fields (i.e. create new text watermark, etc.)

    From: santa-satan [email protected]<>[email protected]>

    Reply-To: "[email protected]<>[email protected]> ' [email protected]<>[email protected]>" "

    Date: Wednesday, February 8, 2012 06:26:18-0800

    To: Leonard Rosenthol [email protected]<>[email protected]>

    Subject: Add a watermark with fields with JavaScript / c#

    Add a watermark with fields with JavaScript / c#

    created by santa-satanhttp://forums.adobe.com/people/santa-satan> in Acrobat SDK - see the discussion complete onhttp://forums.adobe.com/message/4193350#4193350

  • "import as layer" with javascript?

    Hello!

    I was wondering if there is one here who could give me some batch processing javascript in Acrobat tips. My problem is the following... I have many (thousands) of pdf that have an object on a layer with incorrect data. In Illustrator, I wrote a script which allows to reconstruct this object fills with correct data from a csv file and then saves in a pdf file with a name that matches the master pdf, in that it must be inserted.

    What I want to do with a batchscript of javascript is for each open file is to find the file name and the newly created pdf file is found (done) then do something equivalent to the command "import as layer" and import to an existing layer already in the main PDF so the new masks the old object. This I can't do... Well, really, I can't do a lot with js in acrobat for that matter. I can't even a var to return a value to the colsole for testing. It returns no "defined."

    I can find the layer I need to manipulate with ' this .getOCGs () [0] ", the layer I need to handle reaches zero and using the"Merge layers"example in the Guide scripts JavaScript Acrobat a layers properties are modified to match the target layer but it always appears as a distinct physical layer.

    What I just wrote is unable to make sense of bones of bunch so in other words... What I want to do with javascript, it is the action of the "Import under the layer" option selected in the layers panel in mirror. The function key I want to make is in the 'Options of Import' is to 'add to the existing layer.

    I appreciate any help that can be offered.

    JT

    There is much that can be done with JavaScript in Acrobat.
    As far as I know, you can add or merge a layer directly, but you can add a BCG with the addWatermarkFromFile() method.

    About the console, simply run your code and either select the name of the variable you want to examine or type it, and then press Ctrl + Enter. It displays its value. For example, if you run this code:
    var a = 2 + 5;
    one;

    The result will be "7".

  • Problem with JavaScript in my PDF form buttons

    I try to have my user by clicking on a button in my form on my site and the data in the form for me by e-mail.

    I use JavaScript with my form button code:

    this.mailForm (false, "[email protected]", ' ', ' ', 'subject', 'Message body' ' ");

    Protected mode is disabled.

    When I use the above statement (if the 1st is set to true or false), nothing happens - no e-mail is sent and no mail dialog box appears. If I change this.mailForm (...) to this.mailDoc (...), I get a mail dialog box but, as expected, he sends the blank form without the data filled due to low user privileges.

    How can I send the form data with this.mailForm (...)? (Note that I prefer to use this.mailForm (...) rather than mailto: (...)) (this.mailForm (...) because supposedly allows me by e-mail the form without user interaction.)

    -Don

    If you use JavaScript, you use the doc.submitForm method and specify the URL of the PHP script. PHP just needs process the MESSAGE and to join the incoming data to an email that it initializes.

  • Replace h1 with Javascript or CSS image text?

    For SEO, I want to have a h1 Tags at the top of my page title. However, I would like to use an image for the freedom of design. I see 2 solutions to this problem:

    I could either use of css to 'hide' the text. I know that google does not like hidden text, but I could use the index z CSS (or margins?) so that the image appears not in the text. Im not a expert on accesabilty devices, they sometimes use some CSS?

    The other option is to hide text and display an image with javascript. I understand that it's better for accesabilty. However, I do not data soild on it, but a few sites I've found say 10% of people have javascript disabled. What is the number that high?

    Maybe I should use javascript to display an image, but if it is turned off still have some pritty CSS styilng the title h1 and its div.

    Im sure im not the first person to have this dilemma so that everyone recommend?

    Thank you

    Hello

    JavaScript is disabled mainly on the company's computers, unless you run your site to these users worry not too on this subject (you can always check site statistics to see how many visitors actually have javascript disabled), and the number (estimated) current 'normal' users who disable javascript is only 1-2%.

    Regarding the replacement of your text check this article (complete with the required javascript code).

    http://www.quirksmode.org/DOM/FIR.html

    PZ

  • Compare a date with the date system

    Hello

    I use the script (that I found in this forum) in below in order to obtain a date of datefield1, add a year and give the date of datefield2.

    It works very well.

    Kai var = util.scand ("yyyy-mm-dd", this.rawValue);
    var sFullYear = oDate.getFullYear ();
    var sMonth = oDate.getMonth ();
    sDate var = oDate.getDate ();
    Datefield2.FormattedValue = util.printd ("JJ", new Date ((sFullYear+1), sMonth, sDate));
    Datefield2.RawValue = Datefield2.formattedvalue;

    But now I would compare the new date (David [added a year]) with the date current system (cDate).

    Does anyone have an idea how to compare dates? The result should change color as below.

    If (David < cDate) {}
    Datefield2.fontcolor = "255,0,0";
    }

    Thank you very much.

    Kind regards

    ra_be

    Try to use the Date of Javascript object:

    var myDate = new Date();
    myDate.setFullYear (2010,0,14);
    var today = new Date();

    If (myDate > today)
    {
    Alert ("the date is before January 14, 2010");
    }
    on the other
    {
    Alert ("today, it is after January 14, 2010");
    }

    If this does not work, try the analysis on the month, day and year, and then do a comparison on all of them (without forgetting to convert strings of months an integer. For example if you store the release date: February 2, 2009, February goes to 2).

    Then your comparison would look like:

    if(myYear == sysYear) {}

    if(myMonth == sysMonth) {}

    if(myDay == sysDay) {}

    days are equal

    }

    Else if (myDay<>

    myDay is before sysDay
    }

    else {}

    myDay is after sysDay

    }

    }

    }

    essentially to follow this same logic for comparisons of month and year and it should work as well.  It would be certainly cleaner and much easier using this Date however (http://www.w3schools.com/jsref/jsref_obj_date.asp)

  • Back up my data with installation DVD

    I want to transfer my data to an external with installation DVD drive because my Mac OS isn't bootable anymore because of the sierra of mac os. So I'll do a new install of snow leopard on my macbook late 2009. Does anyone know how to transfer my data in my external drive across the disc of the DVD Installer prior to installation of Snow Leopard sanitation? Somone told me to do it this way, but I don't know how.

    I recommend strongly against from any attempt of recovery/reinstallation without a valid (and verified) backup on a different disk. As you are still able to boot the system with the installation DVD, you can

    • use Disk Utility on the installation DVD to create a full backup of your internal drive to an external
    • copy /Applications and /Users to an external drive (which should focus on 'all' critical data)

    Then comes to an attempt of resettlement.

    You can restore your data after the installation of the operating system. First make a note of bookmark, password or registration required by your system.

    Perform a full backup with time machine, then restart with your installation dvd, then reinstall the operating system

    When Setup restarts, you can restore your data with the migration wizard.

    When possible, you should do a clean install with 3rd party applications and drivers HW until the migration may or may not be compatible with the older operating system and removes the possibility of corruption of preference.

Maybe you are looking for

  • EDIT MESSAGES - cannot change new messages.

    Dear support, First of all, thanks for the chat message number address updated. Second, there is another question about modify / delete the new message sent by me. You please consider this also, it is a serious and it must be resolved. I have attache

  • SM BUS controller installation

    i've got trouble installing driver SM BUS controller for my laptop HP 655 . Please someone show me how to do this.

  • STOP with BSOD... gives code 0x0000000A

    I am very frustrated.  I ran all kinds of tests, malware bytes, software tool malware etc etc.  Afgter the stop code, there are 4 other codes (0 x 04021470, 0x85cc05BA, 0x00000001B, 0x00000001)  It's all Greek to me.  Any help... step by step apprec.

  • check registartion early? best way to implement

    Hey guys,. I tried to determine the best way to make my request to verify a valid registration on startup key and if the key is valid, the tracks of the app.  If the key is not there, or invalid, it has a pop up screen to enter a registration code.  

  • BlackBerry smartphone how to add AT &amp; T Navigator icon precision silver theme

    With the theme of precision of AT & T for the "BOLD", there is an icon for AT & T Navigator.  If you pass AT & T Precision Silver theme, is no longer an icon for AT & T Navigator. If I want to run with the theme of precision AT & T money and have an