Help JavaScript code to form Acrobat XI

This form must Text Field, Check box and Dropdown list. The action of this JavaScript is that when the form is saved using the options Save or File> Save As only Text Field, Check box and Dropdown list that have been used to pass Read only and NOT those that the user does not use.
What you want to achieve with this action is:
Save the data written to it can not be edited.
Allow user to finish filling out the form on another occasion.
The JavaScript that follows requires me to put in the Dropdown list as default value (Select  one) otherwise all the passes to Read only and the user can no longer use those that I do not use at the time of storage. Otherwise, it works great.
for (var i=0; i<this.numFields; i++) { 
    var f = this.getField(this.getNthFieldName(i));
    if (f==null) continue; 
    if (f.type=="button") continue; 
    if (f.readonly==false && f.value!=f.defaultValue) { 
        f.readonly = true; 
Please, I need to correct this JavaScript to NOT force me to put the default (Select one) in the drop down lists and run this action only in those in which the user select an option from the list.
Thanks to all who work in this forum.

You cannot create a dropdown value as a null string using the UI.
Have you considered using the default values of a field instead of the null stirng?
How well does your script deal with buttons?

Similar Messages

  • How to edit and reload JavaScript code without restarting Acrobat?

    As a programmer, I wonder if there is a better way to do things that I still cannot figure out.
    At the moment I write code in Notepad++, save it in Acrobat's Javascripts folder, open Acrobat, test the code and find out it doesn't work (no surprise there ).
    I then have to close Acrobat, edit the code in Notepad++, save, open Acrobat and find out again that it doesn't work.
    Rinse and repeat for an inordinate amount of times, especially at the beginning of a new "scripting project".
    The JavaScript Debugger is great but, unless there's something I don't know, doesn't let me edit the code directly in its window.
    As you have worked out already I'm referring to folder-level scripts, so the "Document JavaScripts", "Set Document Actions" and possibly even the "Edit all JavaScripts" buttons are in fact useless.
    Adobe Acrobat and Adobe Reader... ain't no Visual Studio and I don't want them to be but please tell me there's a way to write code a little bit more on-the-fly
    Thanks!
    Roberto

    Thank you both for your posts!
    I spent a few days working and experimenting with Javascript in Acrobat and my first impressions are sadly confirmed.
    try67, you are absolutely correct, but the console approach for testing and developing doesn't work if the add-on is heavily dialog box based (because debugging is disabled).
    Not to worry though, any difficulty can be overcome and frankly it doesn't take that long to relaunch adobe anyway
    Thanks for your time!

  • Need help with code for adding dates to form

    Hello forum goers
    I'm new to making forms and figured out how to auto add the date, however I need the form to change the date for every copy made.
    For example today is 06/08/2012 if I print 10 copies of the form it will output 10 pages ranging from 06/08/2012 to 06/17/2012. If code exists to do this I would be very gratefull to whoever helps, I also wouldn't mind if that is not possible for manually inputing the start / end dates.
    Currently I print 15-30 copies of the form and hand write each of the dates but I'm just getting to busy to do that. I also cannot print one a day it must be in batches.
    Thanks in advanced.

    What you are asking for is more complex than just setting the current date. Each time the form prints it has to know that it has to change the date. I would suggest doing this.
    First, setup a document level script to set the date to the current date. I suspect that you have already done this?
    Next, Create a "DidPrint" document action to increment the date.  To do this the script will need to scan the current text value of the date, add one day to it, and then reformat it.  You'll find information on this type of scripting in these articles:
    http://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascr
    ipt
    http://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascr
    ipt-part-2
    http://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascr
    ipt-part-3
    Since the increment happenes in the Did Print you will need to print each copy individually. If you enter 10 copies in the print dialog it won't work. You have to print one at a time.  You can automate this activity with a console script.
    One of the advantages of incrementing in the DidPrint is that you can also manually enter a date and it will increment from there.
    Thom Parker
    The source for PDF Scripting Info
    pdfscripting.com
    The Acrobat JavaScript Reference, Use it Early and Often
    Then most important JavaScript Development tool in Acrobat
    The Console Window (Video tutorial)
    The Console Window(article)
    Having trouble, Why Doesn't my Script Work?

  • Javascript code for setting output file name of emailed form in Livecycle

    I was given a task of creating a new form with livecycle. I have no knowledge of javascripting so I am struggling with one of the things I am trying to get this form to do. The overview of this form is people around my company fill out this form then hit a button to email the completed form to me. I was able to accomplish part of this task by using the following code within an up mouse event script on a button.
    oDoc = event.target;
    oDoc.mailDoc({
    cTo: ********@******.com,
    cSubject: "IB Update Request - Instance" + IBInstance.rawValue,
    This takes the form and emails it to me with the data from the field called "IBinstance" in the subject line which is what I want but the file name attached to the email is garbage. presently is says "newupdateform.pdf - Adobe Acrobat Pro.pdf"
    What I would like is some javascript code that I can take the data from the field called "IBinstance" and use it as the name of the file being sent in. Is there a simple code that i can put in this event to allow me to do this?
    Thank you

    Hi Joerg,
    I have been trying to solve this as well, but gave up. I also could not get the workaround you found to work with EFM files.
    If you do find a solution, please update your message to share?
    Thanks
    Julie

  • Is there any limit on JavaScript code used in forms?

    Hi,
    Is there any limit on JavaScript code that we can put in the submit button JavaScript Event Handler's 'onClick' event ?
    I have a code wherein I am calling alert 100 times , but till 90 times it works and if I include the last
    10 alerts in the code , it gives :
    "Exception from wwv_generate_component.build_procedure(WWV-01821) unable to
    generate UI form: ORA-06502: PL/SQL: numeric or calue error: character string
    buffer too small(WWV-16409)"
    Any help would be appreciated.
    Thanks and regards.
    Neeti.

    Hi Ketan,
    If your code can be put inside of a separate JavaScript function, you could either include the function inside of your template or write a separate PL/SQL procedure to print out your JavaScript onto your HTML page using the HTP.P() command (this would need to be called inside of your form).
    Regards Michael

  • JavaScript code in Adobe Forms

    Hi Experts,
    I am new to Adobe Forms in SAP.
    My query is based on JavaScript coding part in Adobe Forms.
    Requirement - Sales Order Creation in SAP via Offline Adobe Forms.
    Scenario -
    In Adobe Form, i have a drop down field which is filled with Customer Name.
    Based on the selected Customer Name, fields like Customer Code, Division and Distribution Channel will get filled automatically in Text Fields
    Mentioned values are available in my internal table.
    Please share the logic for fetching the internal table values via JavaScript code of Adobe Forms and assign it to designated fields.
    Thanks in advance.
    Regards
    Sunil S Girija

    Hi Sunil,
    Please refer the below link.
    SAP Adobe Interactive Forms - Javascript - Code Gallery - SCN Wiki
    If you need more help let me know.
    Thanks & Regards,
    Nandakumar

  • Need help with adjusting Javascript code to work in Adobe Edge (Countdown)

    Hello
    Im a newbie when it comes to working with Javascript and Adobe Edge and need a bit of help with adjusting some javascript code to work with Adobe Edge. A friend of mine helped me with making this javascript code: Edit fiddle - JSFiddle
    Its a simple countdown which counts down to a certain time at a certain date. What I aim to do is to add this code as a trigger on a text-element called "countdown" (within a symbol called "count").
    I have tried to do this as the code is, but it does not work. Anyone have any suggestions?
    Thanks!
    Mvh,
    Øyvind Hermans

    Hello again
    I have stumbled upon a problem with these animations; They crash the browser after viewing them a little while, usually less than 30 seconds in.
    Is this problem also occuring when you watch the animations?
    Is the countdown-code to much for the browsers to handle?
    Thanks in advance for your answers.
    Sincerely,
    Øyvind Hermans

  • Need help with a activation code for Adobe Acrobat X Standard for my PC,, Don't have older version serial numbers,  threw programs away,  only have Adobe Acrobat X Standard,  need a code to unlock program?

    Need help with a activation code for Adobe Acrobat X Standard for my PC, Don't have older Version of Adobe Acrobat 9, 8 or 7. 

    You don't need to install the older version, you only need the serial number from your original purchase. If you don't have them to hand, did you register? If so, they should be in your Adobe account. If not you really need to contact Adobe, though it isn't clear they will be able to do anything without some proof of purchase etc.

  • I have to make inaccessible the Javascript code embedded in a form pdf. How can I do?

    I have to make inaccessible the Javascript code embedded in a form pdf. How can I do?

    You can secure the file and prevent access to the code, but it's very easy
    to overcome that. Alternatively you can use a code obfuscator to make the
    code less legible.
    On Feb 11, 2015 3:51 PM, "marcogolinelli88" <[email protected]>

  • Help! How to fix "Acrobat quit unexpectedly (error code: 0x00000004)"?

    Help! How to fix "Acrobat quit unexpectedly (error code: 0x00000004)"?
    Customer service ask me uninstall - restart PC - CC cleaner tool - restart PC again - reinstall, but still useless.
    Who also facing this problem?

    I already check the permission, but still can't run.

  • Acrobat crashed - can't enter Javascript code anymore!

    I just had Acrobat (8.1.2) crash on me while I was working on the Javascript code I had in the file. When I opened the file after the crash, the javascript code was empty - everything had been obliterated in the code module. And even when I enter new code and close the editor, when I try to open it again, it's empty again.
    I have Acrobat set to use an external app (I am using TextWrangler on a mac), so I don't know if that has any bearing on what happened, but the file now seems to be corrupted as any code I enter whether in an external app, or in the Acrobat javascript editor does not get saved. I tested the file on another computer, with the same results. Other files work properly on my computer.
    Is there any way to recover the code from the file? I had spent several hours on several parts of the code, and am not looking forward to having to recreate my work.

    Read "KT6-LSR and installing Windows on SATA" post (At this moment is the last in this page). There you'll find many posts about Raid problems.  8)

  • Need javascript code for Acrobat 9

    How do I write the following in javascript to run in Acrobat 9?
    if total <5 then grandtotal = 0
    else if total >1 then grandtotal = total + 5
    Thanks
    Ron

    If it's just a matter of syntax, try http://www.w3schools.com/js/default.asp
    This little fragment would be
    if (total < 5)
      grandtotal = 0;
    else
      if (total > 1)
        grandtotal = total + 5;
    and I'm sure these variables need to be set up first.

  • Javascript code to enable an ADD button to create duplicate tables and pages for multiple entries

    I am using Adobe XI Pro. I have created a multi-page fillable pdf questionnaire that I want to make interactive to the user. Within each page, I have multiple tables that can have ADD buttons to duplicate the table if the client wants more than one test. I would like this table to insert directly below the previous table and they may be able to add upto 5 of these table.
    I also have a couple pages in the questionnaire that require duplication for multiple samples. Eg. One page per sample, and I may have upto 10 samples. I would like the javascript to have an ADD button and then add each page behind the previous related sheet (Original and duplicates together)
    I am not a javascript coder so I would need some examples and a walk through. I did take some developer courses in engineering but it has been almost two decades
    I have search on several forums and cannot find a good resource so I appreciate the help.
    Sincerely
    Tara

    Some of what you want to do can be done using template features and a bit of JavaScript, but if your users will be using Reader, version 11 will be required. You can dynamically add new pages, but adding new tables to existing pages with reflow of content that comes after is not possible with a form created in Acrobat. If you have access to Adobe's LiveCycle Designer form creation software, you can create what's known as a dynamic XFA form that can do all of what you want. You can ask in the LiveCycle Designer forum for more information: http://forums.adobe.com/community/livecycle/livecycle_modules_and_development_tools/livecy cle_designer_es?view=discussions

  • Javascript code error depending on Adobe Reader Version

    Hi everybody,
    I develop a Adobe interactive forms with ALD version 8 on ECC 6.0 system .My forms is only used in offline scenario ( thru e-mail) .My form is set as compatible with Adobe Reader 7.0.5
    In the form i got 2 different tables .
    The first table , let's call it Tab1 , is define as follow :
      Field 1 -> DropDowlist box
      Field 2 -> TExt Field
      Field 3 -> DropDownlist Box
      Field 4 -> DropDownlist Box
      Field 5 to 11 -> Text Field.
    The second table, let's call TAB2 , is define as follow :
      Field 1 -> DropDownlist box
      Field 2 -> Text Field
      Field 3 -> Dropdownlist box
      Field 4 to 10 -> Text Field.
    The content of the DropDownlist of Field1 of Tab1 and Tab2 are similar.
    When user try to click on Field 5/6/7/8/9/10/11 of Tab1 for populate it, i wrote a javascript code to check if Field3 is populate. If not i set a focus on Filed3 of Tab 3 .
    Same check have been written for Tab2 when user try to click on Field 4/5/6/7/8/9/10.
    This code works fine with Adobe REader 8.1 but with Adobe Reader 7.0.9 it doesn't work and that's a main issue because it can't be possible to be sure that all user will use adobe Reader 8.1.
    Adboe Reader 7.0.9 is a pre-requisite as describe in OSS note 834573.
    Does somebody face the same problem and can help me to solve it .
    Regards
    Ps : Here is the javascript i wrote :
    var pos = eval(this.parent.index);
    if (xfa.resolveNode("data...ACTIVITY_DETAIL["+pos+"].SOFTWARE").isNull)
    xfa.host.setFocus(xfa.resolveNode("data...ACTIVITY_DETAIL["+pos+"].SOFTWARE"));
    Edited by: Bertrand DESSERTENNE on Jan 30, 2009 5:01 PM
    I made a mistake when describing the error, I change the explanation.

    Hi Juergen,
    I check this code with Adobe Reader 7.0.9 and 7.1 and that doesn't works.
    With Adobe Reader 8.1 that works .
    I don't test it with Adobe Reader 9.0 , does this version support by Adobe forms in SAP ??
    My main problem is that a lot of user will use this forms . Some of them will use their own computer but some of them will use others company computer so i can't be sure that Adobe reader will be 8.1 and my customer want that test working with Adobe Reader 7.0.9 which is regarding oss note the minimum version for Adobe Interactive forms.
    Thanks.

  • Text Not Lining Up Properly in Fillable Form | Acrobat 9 Pro

    I have a number of documents that were created in MS Word and then I converted them to PDF through Adobe Acrobat 9 Pro. A number of those documents have text fields that the end user will type their data into - example: a message area on a fax cover sheet.
    The original Word document has that area lined such as this:
    When that area (as shown above) is converted as a field in the "add fields" to the form in Adobe Acrobat I am deleting out the individual fields Adobe "detects" and instead making it one large content box.
    Under properties I have "multi-line" and "scroll long text" selected.
    Now the problem....for some unknown reason....some fields are working perfectly that when we type into the PDF fillin form that the text that is typed lines up perfectly with the lines (as shown above). In other instances it's not lining up at all.
    I have played with font size, font type, spacing on the original Word document.I have scoured the internet and the forums with no success (either no one else is asking or I'm not using the proper search terms).
    Can anyone help me out or point me in the right direction?
    I've also included a screenshot of the document so you can see the wackiness.

    You don't have direct control of the leading of a multiline text field. A common approach is to control the background color of the field with JavaScript since the lines are not really needed when the field is used in Reader/Acrobat. They may be useful when using the form by hand. For more information, see the posts by Max in this topic: http://acrobatusers.com/forum/forms-acrobat/how-do-i-use-multi-lined-text-fields-over-prin ted-line-area-existing-form

Maybe you are looking for