Document Level Scripts .. Need a simple example!

I've been trying to add a function to a form just to avoid writing the same script over & over again & am not succeeding :|
I'm trying to add even only an app.alert function..
I add a script object under a subform 'P1' called 'hello'..
in hello, i write
function hello1
app.alert("hello")
you can see the hierarchy here:
http://i29.photobucket.com/albums/c271/mashdown45/screen.jpg
in order to call the hello1 function from a button, on the click event, i add the following:
form1.P1.variables.hello.hello1();
but am getting an error
TypeError: form1.P1.variables.hello123 has no properties
1:XFA:form1[0].P1[0].Button1[0]:click
(you all must be thinking: 'obviously'.. but i cannot figure it out!)
Thank you in advance..

Hi Chris. I created a variable named hello in the hierarchy and typed in:
function hello1()
app.alert("hello")
Then in the click event of the button I put:
form1.P1.variables.hello.hello1();
I think all you needed were the "()" after the function name.

Similar Messages

  • Delete Document Level Script Using JavaScript?

    Hello all.
    Is there a way for a document level script to delete itself? I am running Adobe Acrobat Professional 11.
    My situation is that I am currently analysing data using a Java application. The Java application taylors a script to suit each specific PDF, and then inserts it into the PDF automatically. When the PDF is opened, the script runs once and then is no longer needed.
    As the script is no longer needed it would be preferred if the script could automatically be deleted. Is it possible the script has access to the field in which it is stored (e.g. doc.javascriptField = "";)? Or by some miracle, a delete function already exists?
    I think that due to the lack of need for such a function by general and advanced users I won't get the answer I am hoping for. But it is worth a shot. In the mean time, I am inserting a flag into the KeyWord field so that the script does not run twice. It works, but it is not exactly clean.
    Any help would be greatly appreciated.
    Thanks
    Jonny O

    My original idea of...
    stamper.addJavaScript("this.addScript("oneTimeScript", "app.alert('Annoying Popup')")");
    Did not work.
    However, while debugging I did come across the name given to a script added via iText (Java library). The default is "000000000000000". With any added scripts being incremented by 1. So the this.removeScript("ScriptName") function works perfectly.
    Thanks
    Jonny O

  • Document level script to display zeros in calcuated field

    I have created a form, with the calculated fields set to read only, and with a validation script of
    if (event.value == 0) event.value = '';
    (so that the calculated fields do not display as $0.00)
    All but four of the calculated fields are named Item.0, Item.1 etc., plus there are SubTotal, ShippingCharge, CCFee and Total fields that need to stay blank until data is entered into the form.
    Initially, I tried to add the script as a document level script, but it didn't work and I'm thinking it needs more to the script to use at the document level, but I have no idea what more it needs.
    Where did I go wrong?  It certainly would be quicker to add calculated fields if I didn't have to add that validation script to each.

    Even with a document level script you would need to call it in every calculated field.
    I you were to write "app.alert("Hello World");" as a document level function, it would only execute when the PDF was initialized or opened and not again as long as the PDF remained open.
    If you rote a document level function using JavaScript like:
    function Hello() {
    appp.alert"Hello World, I am a function");
    return true;
    It would never run until called  with  a JavaScript statement like "Hello();"
    So even with a document level script and preferably a function, you still would need to edit every calculation to call the function or the script would never run.
    You could also create a document level function to suppress the zero display and then write more code to add the call to this function to the calculated fields.
    You need to learn more about the scope of items, how events are processed within a PDF, what functions are and how to use them effectively. You might want to start with getting or linking to a copy the Acrobat JS API Reference.

  • Document level scripting from process workflow

    Hi all,
    is there some way to add a "document level" script from process workflow in Livecycle Workbench?
    That is, I have a script i want to add to a pdf in my process workflow. How can I do that? Is there some service/function/script I can use to do that?
    I'd really appreciate any help.
    Thanks
    Alessio

    Not that I am aware of, could be wrong though

  • Document level scripting

    I have read about document level scripting -
    This is a nice feature - since it allows a certain level of generalization rather that writing a scriptlet for each objects events.
    I am using Live cycle designer 8.2
    How can I create a document level javascript function ?  i can't see how to do it .
    I am familiar with java scripting and have been scripting for a number of events but i would really like to be able to have a callable function that I pass certain parmeters to for processing.
    please indicate how I can do this .
    Thanks

    You should post this in the LiveCycle Designer forum here, if you haven't already.

  • I need some simple examples to start with for Oracle ESB

    Hi All,
    Please share some simple examples to startwith for Oracle ESB.
    I need to understand, what are the files are created, once created an ESB project.
    What is the use of the files how to edit them with out using JDeveloper.
    Iam trying to create a simple example.
    I would like to create a file which has only "HELLO" in that file, simple text file inside a folder "INPUT" in my c:\ drive.
    I wanted to create a ESB service which picks up the file and add a string to it like "HELLO" + "ESB" and drop this file into "OUTPUT" folder in c:\ drive.
    How do i do that. I tried to do it when i deploy the integration server connection is gettting hit badly. I dont see that connection any more and i dont see that connection in my JDeveloper.
    I dont want to start with existing code.
    Please help
    Regards,
    Vijay.B
    Message was edited by:
    Vijay.B
    Message was edited by:
    Vijay.B

    Hi,
    If you want to do it from scratch you can basically do the following:
    Make sure you have created an application server and integration server connection in JDeveloper.
    1) Create a new JDeveloper project of type ESB project.
    2) Possibly add a ESB System/Group (open the esb file and click "Create System/Group") to group ESB projects.
    3) Create an XML schema describing your input XML file. Probably one element of type xsd:string.
    4) Create an example XML file which is well-formed and valid according to the XSD from step 3.
    5) Create a new File adapter (inbound/read). A routing service is automatically created.
    6) Create a new File adapter (outbound/write).
    7) Create a routing rule in the routing service in which you invoke the write method of the outbound file adapter. Possibly add a transformation using the XSL mapper.
    8) Deploy the ESB project to the server.
    9) Drop your XML file (from step 4) in the directory in which the inbound file adapter is polling.
    10) If it is ok, the file should be picked up, transformed and dropped in the outbound directory. A new ESB instance should be visible in the ESB console.
    See what files are generated on the filesystem in each of the above steps.
    Regards, Ronald

  • I need an simple example on java-Oracle8i entreprise

    Hi,
    Could anyone give me an simple example of a Java method which will be loaded into Oracle.
    Let say, the method will read the email address based on employee_ID from a table called Employee. Thank you very much for all your help.
    Hellenie
    PS: I would like to see java code and to see how it could call a table without having to deal with connection object ,statement,etc...
    null

    This is the example from the Oracle's 8.1.6 Documentation - Java Stored pocedures Developer's guide -
    step 1 :
    import java.sql.*;
    import java.io.*;
    import oracle.jdbc.driver.*;
    public class RowCounter {
    public static int rowCount (String tabName) throws SQLException {
    Connection conn = new OracleDriver().defaultConnection();
    // here is the connection made
    String sql = "SELECT COUNT(*) FROM " + tabName;
    int rows = 0;
    try {
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery(sql);
    // same old createStatement, executeQuery ...
    while (rset.next()) {rows = rset.getInt(1);}
    rset.close();
    stmt.close();
    } catch (SQLException e) {System.err.println(e.getMessage());}
    return rows;
    Step 2:
    use loadjava command line utility and
    specify the class name, username/password to
    load the code into the database.
    step 3:
    On sql prompt, the class and method name are
    mapped to stored procedure
    CREATE FUNCTION row_count (tab_name VARCHAR2) RETURN NUMBER
    AS LANGUAGE JAVA
    NAME 'RowCounter.rowCount(java.lang.String) return int';
    You can invoke the procedure using CALL method from SQL prompt.
    Cheers,
    Adithya
    null

  • I need  a simple example of shopping cart(newbie)

    Has any one come across a simple example of shopping cart and the process
    behind it i.e. from jsp to ejb. So far I have looked at the buybeans example
    and it still is not clear the approach that was used.
    I would be greatful for any assistance thank you
    Kenneth A-Adjei

    Take a look at:
    http://java.sun.com/docs/books/tutorial/servlets/overview/example.html
    "Ken Adjei" <[email protected]> wrote in message
    news:3960a901$[email protected]..
    Has any one come across a simple example of shopping cart and the process
    behind it i.e. from jsp to ejb. So far I have looked at the buybeansexample
    and it still is not clear the approach that was used.
    I would be greatful for any assistance thank you
    Kenneth A-Adjei

  • Need a simple example program code to use SF_EXAMPLE_01

    Hi all,
    I have just try to learn smartforms. As i have SAP NW4 for learning.
    I found SF_EXAMPLE_01 in the system.
    Can any body help me out how to use this example in abap program code?
    Thanks.
    rob

    Smart Forms, try this steps.. it will teach you how to create smart form and how to use it.
    1) Tcode --> SmartForms
    2) Form name --> Z_SF_TEST Create
    3) Under Global settings
    a) Form Interface  
        Table Tab
       ITAB LIKE EKPO
    b) GLOBAL Definitions
    WA_NETPR LIKE EKPO-NETPR
    In smart forms if we want to display quantity and currency fields. We can't directly display currency field and quantity fields
    For that we have to create an extra variable in global definitions
    Ex: netpr FIELD of EKPO
    CREATE program lines and specify WA_NETWR = itab-netpr.
    4) RT CLick on main Window
       CREATE --> TABLE
      Click Table painter
    DEFAULT %LTYPE will be Created
    a) If you want more like Header footer etc add by rt click on %LTYPE1
    Table (Tab)
    %LTYPE  Radio(SELECT) 5 CM 5 CM 6 CM
    CLICK on DATA (Tab)
    INTERNAL TABLE ITAB LIKE ITAB
    5)RT click on table control and create --> program lines
    General attribute (Tab)
    INPUT PARAMETER               OUTPUT PARAMETER
    itab                               WA_NETPR
    Code Area
    WA_NETWR = ITAB-NETPR.
    6) RT CLcick on table ctl and create 3 text to display the fields
    a) % text1 +button(insert field)
       FIELD name &itab-ebeln&
    Output options (tab)
    Check New line   LINETYPE   %Ltype1
    check new cell
    b) % text2
       & itab-ebelp&
    output options
    check new cell
    c) % text2
       & wa_netpr&
    output options
    check new cell
    Report ac
    Tables ekpo.
    Data: itab1 like ekpo occurs 0 with header line.
    select * into table itab1 from ekpo.
    Call function module   "to know function module name goto smartform and execute the smart form name it will give you the function module name.
    If your question is answered, close the thread and reward all useful answers...
    Regards,
    Sairam

  • Document Level Header Scripts

    Hello -
    I am looking for any assistance you may have.  I am working on a project in Acrobat Professional 7.0 that requires me to add the computer username to the header of a pdf file.  I have determined, and implemented this in Excel files using an onopen event.  I need to do the same thing but in a pdf file.  I have absolutely no javascripting experience so the more basic your explanation the better.
    After reading up on the internet, I believe that I need a document level script?  I found an example that is:
    this.addwatermarkfromtext({
    ctext: "Confidential Document",
    ntextalign: 2,
    nhorizalign: 2,
    nvertalign: 0,
    nhorizvalue: -72,
    nvertvalue: -72,
    I entered that under Advanced, Javascript, Document Javascript but I receive an error that says typeerror: this.addwatermarkfromtext is not a function.  Again, I would need to change it to pull the username (I am assuming I can do this with a variable?).  I appreciate any and all help.
    Thanks in advance for your time.

    Thanks for the quick response.  Here is my situation.  The pdf file contains highly confidential information.  I want to email it out and have the username automatically appear in the header or footer so everyone is aware of who printed the copy.
    If, according to your last post, cannot assign that to the document level then must that be applied on everyone's computer?  Please note that I am the only one with Professional.  All users will be using the Reader only.
    Thanks again for all of your assistance.  It is greatly appreciated.

  • Document-level Javascript as Object

    I created a document level script called Utility.
    I want to create methods within this script rather than coding each one separately.
    function Utility()
    this.getFormattedDateOnly=function(pDate) {
      if (typeof pDate == "undefined") {
        pDate = new Date();
      var retval = util.printd("m/dd/yyyy",pDate);
      return retval;
    this.getFldsOnPagenum = function(pPageNum, pDoc) {
      /* returns an array of the form fields who are on or start on a page */
      /* zero based return ; however pPageNum is 1 thru numPages, not 0 -> numPages-1 */
      var currPage;
      var currFld;
      var cnt = -1;
      var ARflds = [];
    CPR("# flds=" + pDoc.numFields+" Type of pDoc:"+ (typeof pDoc));
      for (var i = 0; i < pDoc.numFields; i++) {
        currFld = pDoc.getNthFieldName(i);
        if (typeof currFld.page == "number") {
    CPR("page="+(1*currFld.page+1));
          if ((1*currFld.page+1) == pPageNum) {
            cnt++;
            ARflds.length = cnt + 1;
            ARflds[cnt] = currFld;
    CPR("\n cnt="+cnt);
        } else if ((1*currFld.page[0]+1) == pPageNum) {
          cnt++;
          ARflds.length = cnt + 1;
          ARflds[cnt] = currFld;
      return ARflds;
    var MyUtil = new Utility();
    This is all working fine with the following exceptions:
    1) the methods are not being registered in the Javascript hierarchy listing.
    That's annoying.
    2) "This" is not recognized at the document level....I must pass it as a parameter (pDoc).
    I thought that was strange...I could see it if were at the folder level.
    It appears the document object is out-of-scope !!
    3) currFld = pDoc.getNthFieldName(i);
    The above is failing....sending back a "currFld is undefined" error.
    I don't see the problem....very strange IMHO.
    When I call the getNthFieldName function from the console....no problem.
    What am I doing wrong in the definition here ?
    It appears that what I did has Acrobat functions and document properties out-of-scope.

    I think this would work if you could make the document object a member of the Object being created.
    To do that, a constructor needs to be invoked so that it can instantiate a public property of the Object.
    var MyUtil = new Utility(this);
    inside of Utility I would have:
    this.oPDFdoc =  this;
    thereby transferring a reference to the entire PDF document to my Object.
    Getting this to work would eliminate the need for all of the document-level javascript references.

  • How do I validate a certificate (not visible) at the document level?

    I am using Acrobat XI Pro running in Windows 8.
    I created a PDF document with form fields (type: button) and JavaScript codes (field-level and document-level). Before I certify (not visible) and save the document, I want to add a document-level script that checks if the certificate is valid. If the certificate is valid, I would like to  schedule an interval object to update some of the icons in the fields. Is this possible? If so, how do I get the “certificate (not visible) field” and check that it is valid
    Thanks. - john

    I am using Acrobat XI Pro running in Windows 8.
    I created a PDF document with form fields (type: button) and JavaScript codes (field-level and document-level). Before I certify (not visible) and save the document, I want to add a document-level script that checks if the certificate is valid. If the certificate is valid, I would like to  schedule an interval object to update some of the icons in the fields. Is this possible? If so, how do I get the “certificate (not visible) field” and check that it is valid
    Thanks. - john

  • Simple example of chat

    I am needing a simple example of chat made with spry…
    using an archive xml I am not obtaining to bring up to date the
    messages!

    You can do it with a $1000 dollar server, and much much much more, just not Adobe's $1000 dollar "server".
    I would have to say that I have yet to come across even one client that wasn't completely pissed off when they bought the streaming version and realized how little it does. I can't even imagine how many support calls have gone in to Adobe for either a full refund or an upgrade to a now extremely disgruntled customer. It's a shame, gives FMS and Adobe a bit of a bad name despite the amazing product FMIS is.

  • I need for a simple example of  reading a xml file using jdom

    Hello
    I have been looking for a simple example that uses Jdom to read am xml file and use the information for anything( ), and I just can't find one.since I'm just beggining to understand how things work, I need a good example.thanks
    here is just a simple cod for example:
    <xmlMy>
         <table>
              <item name="first" value="123" createdDate="1/1/90"/>
              <item name="second" value="456" createdDate="1/4/96"/>
         </table>
         <server>
              <property name="port" value="12345"/>
              <property name="maxClients" value="3"/>
         </server>
    </xmlMy>Dave

    Hi,
            FileInputStream fileInputStream = null;
            try {
                fileInputStream = new FileInputStream("my_xml_file.xml");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } finally{
                if (fileInputStream == null) return;
            SAXBuilder saxBuilder = new SAXBuilder();
            saxBuilder.setEntityResolver(new EntityResolver() {
                public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                    return new InputSource(new StringReader(""));
            Document document = null;
            try {
                document = saxBuilder.build(fileInputStream);
            } catch (JDOMException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                if (document == null) return;
            Element element = document.getRootElement();
            System.out.println(element.getName());
            System.out.println(element.getChild("table").getName());

  • Need simple example of flex2 to webservice

    Hello,
    I understand that so long as you don't use remote objects,
    you don't have to buy the FDS! So how do I bypass using FDS and
    just use HTTPS or webservices?
    Can someone point me in the right direction with a
    good/simple example of using flex 2.0 with https and/or
    webservices?
    Thanks,
    K.

    OK - I finally get this.  I guess that SAP Business One is the entry level, least expensive license.  If my company buys SAP Business One, will that provide the R/3 system and BAPIs to build some demos?  And can I hook up SAP Business One to the Sneak Preview SAP NewWeaver 6.40 in order to invoke the BAPIs using Java?
    And I guess that if we buy SAP Busienss One, then I don't need 6.40 ABAP stack to invoke the BAPIS - or do I?
    Thanks for your help.

Maybe you are looking for

  • What's wrong with this one?

    Offset: GW803HP1 on Netware, also duped with GW2012SP1 on SLES The following is a snippet of a mail which gets generated by a scan on some sort of multifunction printer: --snip-- X-Mailer: RICOH Email Diag System Alert Info MIME-Version: 1.0 Content-

  • My iPad 2 won't transfer to PC!

    Ok, pulling my hair out now after searching all these forums.  Trying to update my iPad 2 from 5.1.1 to 6.1.3.  iPad is nearly fully, and in fact states in iTunes that it is over capacity by 215.7 MB (on a 16 GB Pad).  I am having the following probl

  • A few simple questions from a new Iphone user

    Hi a few simple questions, just got an iphone 2g - 2nd hand so not really sure what to expect. Anyway I guess my first question is about mine sometimes being a little slow - when I look at contacts and sometimes when sending a txt it slows down/freez

  • Mapping runtime

    Can any one explain mapping runtime with documents pls

  • How do I backup a 4s phone

    how do i backup seems like it should be something simple