A question on script objects

I have placed a script object on my form to control the field color and it works fine in Adobe Reader X but not in previous versions of Reader and not in Acrobat pro 9.
Can anyone tell me what’s wrong?
The script object looks like this:
form1.#variables[0].RGA_format - (JavaScript, client)
function RGA_colorOld()
xfa.resolveNode("this.ui.#textEdit.border.fill.color").value = "220,220,220";
function RGA_color()
xfa.resolveNode("this.ui.#textEdit.border.fill.color").value = "255,255,255";
And is called from the fields on the docReady event and the Change event by this script:
form1.blanketB.Moder.EftNvnMor::docReady - (JavaScript, client)
RGA_format.RGA_colorOld(this);
form1.blanketB.Moder.EftNvnMor::change - (JavaScript, client)
RGA_format.RGA_color(this);
Regards,
Kirstine

Hi Kirstine,
When calling the function, you are passing through the object as a parameter. However the function in the script object does not have a corresponding parameter to receive this.
You can probably pass the object reference through as:
RGA_format.RGA_color(this);
However I prefer to declare a variable first and pass this through:
var fieldObj = this.somExpression; // declare a variable to be passed into the function
colourControls.fieldGetsFocus(fieldObj); // calls the function "fieldGetsFocus" in the script object "colourControls"
Notice in the example, I when declaring the function, I have a parameter "fieldObj", to receive the information that is being passed through.
function fieldGetsFocus(fieldObj) // first function
A small point about the function in the script object. I know the function is a single line, but I would prefer to see this wrapped in curly brackets.
Lastly changing the fill requires access to the ui properties. These are different for each object type. For example the script you have is for a textfield. This would not work on a numericfield.
I do have an example here of a function that does what you are looking for: https://acrobat.com/#d=XGj9UEk4lSbDSoArnQU8dQ. Note how I check what the object is and then resolve the correct ui property. This makes the function must more reusable.
Hope that helps,
Niall
Assure Dynamics

Similar Messages

  • Technical interview questions on this objects

    Hi every one  i am putting some objects in my resume can any one tell me the all possible questions on these objects.
    my id is [email protected]
    Reports:
         Developed a Report to display the values of Total Finished Goods filtered by Plant.
         Created an Interactive Report for displaying vendor information. Based on the selection made the corresponding Vendor Details are listed such that the line selected in the basic list was visible along with the secondary list.
         Developed a Report, which calculates the delivery values and sales for a particulars month and year including total quantities.
         Created reports in SD module such as sales order report, which covers all organization levels, delivery status, invoice status, shipping details and partner function details.
          Conversions:
         Designed and coded a BDC program to migrate Vendor Master Data from legacy system to SAP R/3 database.
         Designed and coded a BDC program to Update and Change Vendor Master Data from legacy system to SAP R/3 database.
         Designed and coded a BDC program to migrate Material Master Data from legacy system to SAP R/3 database.
          SAP Scripts:
         Modified Standard Script MEDRUCK according to client requirements.
         Modified Standard Script SAPFM06P according to client requirements.

    Hi every one  i am putting some objects in my resume can any one tell me the all possible questions on these objects.
    my id is [email protected]
    Reports:
         Developed a Report to display the values of Total Finished Goods filtered by Plant.
         Created an Interactive Report for displaying vendor information. Based on the selection made the corresponding Vendor Details are listed such that the line selected in the basic list was visible along with the secondary list.
         Developed a Report, which calculates the delivery values and sales for a particulars month and year including total quantities.
         Created reports in SD module such as sales order report, which covers all organization levels, delivery status, invoice status, shipping details and partner function details.
          Conversions:
         Designed and coded a BDC program to migrate Vendor Master Data from legacy system to SAP R/3 database.
         Designed and coded a BDC program to Update and Change Vendor Master Data from legacy system to SAP R/3 database.
         Designed and coded a BDC program to migrate Material Master Data from legacy system to SAP R/3 database.
          SAP Scripts:
         Modified Standard Script MEDRUCK according to client requirements.
         Modified Standard Script SAPFM06P according to client requirements.

  • Mapping action script object to mx:model object

    Hi all,
    I am having an action script class and an mx:model element
    with same elements. I want to assign an action script object to
    this mx:model. How can I do that one?
    Let me state it clearly.
    Say, my action script class contains two elements - user and
    rollno with required getter and setter methods.
    And I am having an mx:model element with the following
    format.
    <mx:model id="data">
    <data>
    <user/>
    <rollno/>
    </data>
    </mx:model>
    I want to assign an instance of action script class to this
    model object.
    I tried extending action action script class from Objectproxy
    and used data=actionscriptinstance.
    But it's not working properly.
    Is there anyway I can do this one?
    Thanks in advance

    The quick answer:
    <mx:model id="data">
    <data>
    <user>{ myASObj.user }</user>
    <rollno>{ myASObj.rollNo}</rollno>
    </data>
    </mx:model>
    The bigger question might be, "Why have the mx:Model?"
    The Model tag is all Strings, so you lose data typing.
    Why not just create a value object (VO) for your user data
    and pass that around?
    package samples.user {
    [Bindable]
    [RemoteClass(alias="samples.user.User")]
    public class User {
    public var user:String;
    public var rollNo:int;
    Then when the result data returns, cast to the VO.
    public var user:User = (eventObj.result as User)

  • Using a script object

    Hi,
    I have beginner skills using LC Designer ES and am trying to insert and use a script object. I found a JavaScript function online: http://home.online.no/~pjacklam/notes/invnorm/impl/misra/normsinv.html and am trying to get it to do some math calculations in a Designer form.
    I've uploaded a sample test form at: http://elearningprojects.com/TestFormula1.pdf
    Can't get it to work.Trying to run the JS formula in the script object (by clicking on a button), using a few hard-coded variables, and display the results (Dprime1 and Dprime2) in 2 text fields.
    I would much appreciate if someone can take a look and suggest how to get it working correctly.
    Thanks for your help.
    Kind Regards,
    saratogacoach

    Hi Paul,
    Thank you for your reply and suggestions. With beginner skills in LC Designer (I'm a retired social worker), I am not sure how to do this.
    Is my identifying the script object path correct?
    form1.#subform[0].#variables[0].SO1.function_name(NORMSINV(p));
    When you say "You are calling this function a few times in your code so you will have to modify each call." I am not sure how to change this.
    I currently have (note that I added the SO1. to the function calls):
    var p = totalscore5
    var probit1 = SO1.NORMSINV(p)
    var p = totalscore6
    var probit2 = SO1.NORMSINV(p)
    var Dprime1 = probit1-probit2
    var p = totalscore8
    var probit3 = SO1.NORMSINV(p)
    var p = totalscore7
    var probit4 = SO1.NORMSINV(p)
    var Dprime2 = probit3-probit4
    Can you specify what a modified script would look like? I'm stuck.
    Also, have I set up displaying the Dprime1 variable's value in the TextField1 correctly?
    Thanks very much for your help.
    Regards,
    saratogacoach

  • Acrobat standard 9.0 error while enabling commets option using Java script object

    I'm using the below java script code in my VB 6.0 application for enabling commets options in the PDF file
    Dim oJSO As Object
    Set oJSO = mPDDoc.GetJSObject
    oJSO.Collab.showAnnotToolsWhenNoCollab = True
    It is working fine till Acrobat 8.0. Now I'm trying with Acrobat 9.0 standard edition, it is throwing scripting error 'An unhandled Win32 exception occured in Acrobat.exe[308].
    Can anyone suggest the way to enable 'comment' options in Acrobat Standard 9.0 using Java Script Object?
    Thanks

    I get much the same problem with VB6, Acrobat 9 Pro and WinXP SP3. When I single step the line:
    oJSO.Collab.showAnnotToolsWhenNoCollab = True
    in debug I go to the error handler for my Sub. Inspecting the VB Err object has Number = -2147417851 and Description = "Automation error
    The server threw an exception." I get a Microsoft crash notice about Acrobat a short while later.
    I've experimented with the JavaScript debugger in Acrobat and you can execute Collab.showAnnotToolsWhenNoCollab = True and reference the value of Collab.showAnnotToolsWhenNoCollab in the console. The problem appears only when accessing Acrobat Javascript through the Interapplication Communication API.
    If anyone can help it would be appreciated. I tried Adobe's Acrobat support and they were no help at all.

  • How to reference JavaScript functions stored in a script object on a different page?

    Hi,
    I have a form which has 2 pages. I have a bunch of JavaScript functions under script objects on page 1. How can I access these functions from page 2?
    I tried the following but none of it work:
    form1.page2.#variables[0].testScript.doThisNow();
    form1.page2.variables[0].testScript.doThisNow();
    form1.page2.variables.testScript.doThisNow();
    Please help.

    Hi,
    Simplest way would be to drag the script object to be under the root node (form1). On both pages would would then be able to reference the function by:
    testScript.doThisNow();
    If you leave the script object under page1, then from page2, the following should work:
    page1.testScript.doThisNow();
    Hope that helps,
    Niall

  • Functions in script objects not being recognized after certain point

    Hi all,
    I'm wondering if anyone has figured out why after normally about 300-500 lines of JavaScript in a Script Object, sometimes the functions near the end are no longer recognized by the XFA processor when referenced ("TypeError: Scripts.myFunction is not a function").
    When reordered, further up the script object, they work as intended. The line at which it no longer recognizes functions also isn't always the same and I have worked with some script objects that have over 800 lines with all the functions still working.
    I've tested in Designer 9 and 10, Reader 8 9 and 10.
    Please at least let me know I'm not the only one. I knew of one other developer that had come across the same issue.
    Kyle

    Thanks radzmar!
    JSLint didn't find anything but it set me on the path towards looking for syntax errors. I deleted code in the script object line by line until I narrowed it down.
    Turns out it is Regular Expression literals, in particular trying to escape (\) the metacharacters ($.{}[] etc).
    For example, var reg = /\}/; should technically match any right-handed curly brace, which in fact it does! The function that it is in works perfectly but every function written below it is not recognized by the XFA processor. Just out of curiousity I tried reg = /\{\}/; which matches {} and all the functions below now are recognized. It seams as though, even though using the escape character is allowed in core JavaScript, the processor sees it as a syntax error because it's not terminated.
    Anyways, the easy fix is of course using the RegExp constructor var reg = new RegExp("\\}"); but I'll miss the confidence I had using Regular Expression literals.
    Thanks again for the nudge in the right direction.
    Kyle

  • Calling a Script Object

    I'm having some trouble calling a function with arguments froma a radio button click event in the main form. How can this be done?
    This is the way i'm trying to do this now:
    -Script Object code (path: xfa.form.variable.fun1):
    function ex1(var1,var2){....}
    -Call from the radio button click event:
    xfa.form.form1.variable.fun1.ex1(var1,var2)
    Thanx!

    Hi,
    What seems to happen when you remove a form object that has code that is currently executing is that it can't find the next line.  You might want to put all your code in the script object.
    so in the click event you have;
    SOremove.fxremove(this);
    Then your script object will start
    function fxremove(button) {
        button.resolveNode('fifteenSubform._CorrectiveActionWrapper').removeInstance(button.parent.index);
        if (xfa.host.version < 8) {
            xfa.form.recalculate(1);
        console.println("The SOremove.fxremove fired");
    Regards
    Bruce

  • Insert Script Object?

    In Acrobat Pro you can create a document script as follows:
    function Hello()
    app.alert("Hello World")
    And call this Hello.
    If you create button on the page then create an action on Mouse Up Run a JavaScript which looks like this:
    Hello();
    A message box appears saying Hello World click OK and press the button and it keeps coming back.
    Now in Designer this is a little different.
    I create a new page, insert a script object rename it to Hello and type:
    function Hello()
    app.alert("Hello World")
    I then create a button and on the mouse up action type;
    Hello();
    If I try this I get the following mesaage:
    TypeError: Hello is not a function
    1:XFA:form1[0]:#subform[0]:Button1[0]:mouseUp
    Why is it so?
    Even removing the script object and going to the Form properties Variables tab and entering the function script there does not seem to work.

    Thanks Steve,
    It works without a hitch. Im still getting my head around JavaScript and 2 weeks, 6 hours a day of reading and testing and reading is slowly getting clearer I think.
    Just to make sure Im getting this clear in my head. The way I had the script before was when it was applied to the field that showed the value it was referring to this as the field itself. So it worked not worries because it was point to the itself.
    When I tried to apply the same script in a script object field (variables) that the whole documents can reference it was only in as a variable. The line form1.variables.setTotals.Totals(); did not do anything because it did not see the totals as a function and refer to it, and as a result nothing would appear in the filed. By adding obj to the script it tells the form that its an object and the objects formula is spei1 + spei2. This now means that the script can be applied to any filed and that is where form1.variables.setTotals.Totals(this); comes in. It tells the filed apply the object (Totals [spei1 + spei2] ) to this filed.
    Does this mean that any script placed in the Variables field needs to be referred to as objects?
    The reason I was taking this approach was to resolve a problem posted earlier.
    I thought by having the script as a script object that was applied to the document rather than the field it would update the other fields that refer to it. Which I now realize will not happen. Could you suggest a conditional statement that I could put in to:
    If special item 1 = $12.00 the result in the total = $12.00. If I then click on one of the fields in the special column say in Monday for example the result should be $12.00. If I then decide to enter another $12.00 in special item 2 the total will now be $24.00 but the Monday result will still say $12.00.
    Is there a way to have it check that it the figure which may appear in the Special column, to update that result as well?
    Should I be look at a message box instead telling the user there is a difference and for them to re-click on the Monday field to update it?
    Any suggestions would be appreciated.
    Regards, John.

  • Script Objects Disappearing when 2 or more XDP's are stitched together

    We use Adobe Form Server.
    We would like to use Script Objects in our forms. Unfortunately, when we stitch two or more forms together, only the first script objects [contained in the first form] remain. The other script objects [in each additional form] fall off.
    The script objects are unique to the form and are named differently (ie. "GlobalFunctions_8190" vs "GlobalFunctions_200878").
    How can we correct this? Is it how the Form Server was set up?
    Please help.

    Just in playing with it, I added an extra ${endif} at the end of the network section and the error went away.   Since I only have one network connection, I don't know if it breaks something else or not.

  • Calling a Script Object after remove instance index[0]

         I have created a LiveCycle document that has a repeatable subform as url linked below. The form will not let me call a Script Object after removing an instance at index[0]. Regardless of the number of instances remaining. I use a script object to show and hide buttons. Adding an instance is not a problem. What to do?
    Script on Delete Subform Button (Error):
    xfa.form.recalculate(1);
    this.resolveNode('fifteenSubform._CorrectiveActionWrapper').removeInstance(this.parent.ind ex);
    if (xfa.host.version < 8) {
    //deleteing a [0] index seems to create a problem for executing the function in this Script Object
    SOremove.fxremove();
    https://files.acrobat.com/a/preview/03389d79-9020-45d9-ba4f-fb4cbdc21f77

    Hi,
    What seems to happen when you remove a form object that has code that is currently executing is that it can't find the next line.  You might want to put all your code in the script object.
    so in the click event you have;
    SOremove.fxremove(this);
    Then your script object will start
    function fxremove(button) {
        button.resolveNode('fifteenSubform._CorrectiveActionWrapper').removeInstance(button.parent.index);
        if (xfa.host.version < 8) {
            xfa.form.recalculate(1);
        console.println("The SOremove.fxremove fired");
    Regards
    Bruce

  • Importing Script Object

    Is it possible to make a Script Object part of the library in order for quick drag-and-drop additions to forms?

    I don't know what you're doing wrong. It works for me. The subform acts as a wrapper so that you can add the script object to the custom library.
    - From the library tab, drag a subform onto your form.
    - In the hierarchy tab, right click the subform that you just added and click "insert script object"
    - Put your code in the script object.
    - Drag the subform from the Design View (not the hierarchy) to the Custom library tab for sharing/reuse.
    - In the hierarchy, move the script object from the subform node to the page node
    - Delete the subform.
    To use the script object.
    - Drag the custom subform onto the Design View
    - In the hierarchy, move the script object under the page node
    - Delete the subform.

  • Edit and Store a Script Object

    Hi, All!
    I know there must be a way to do this:
    I want to be able to create a script based on user input and then store it for later use. Here's an example:
    display dialog "How many beeps?" default answer "1"
    set beepNum to text returned of result as string
    script beeper
    beep beepNum
    end script
    store script beeper in ((path to desktop as string) & "Beeper.scpt")
    So, what I don't want is the stored script to need the variable to be defined.
    So, say the user types in a 5. Then, I'd want the stored script to read "beep 5".
    Thanks in advance!

    I use a couple of tools for something similar, although they just paste handlers or code snippets into the front Script Editor document. The following script will compile script text to an application on your desktop:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the AppleScript Editor">
    set theDesktop to quoted form of POSIX path of (path to desktop) -- this will be where the application is saved
    -- a couple of example variables
    tell (current date) to set theDate to (it's month) & " " & (it's day) & ", " & (it's year)
    set theDescription to "osacompile example -- saves the specified script text as an application"
    -- this is the script text - pay attention to quoting
    set theScript to "
    " & theDescription & "
    created on " & theDate & "
    on run -- example
    set the clipboard to escapeString(the clipboard as string)
    display dialog (the clipboard) with title \"Clipboard Contents\" buttons {\"OK\"} default button \"OK\" giving up after 5
    end run
    on escapeString(someText)
    escapes a list of characters for an AppleScript string
    parameters - someText [text]: some text to look at
    returns [text]: the text with matching characters escaped
    set someText to someText as text
    -- set escapeList to {\"\\\\\", \"\\\"\"} -- backslash, quote
    set escapeList to {ASCII character 92, ASCII character 34} -- backslash, quote
    set escapedText to \"\"
    repeat with theChar in (get characters of someText)
    if theChar is in escapeList then set escapedText to escapedText & (ASCII character 92)
    set escapedText to escapedText & theChar
    end repeat
    return escapedText
    end escapeString
    -- add a here-doc wrapper if not using a file
    set theScript to "<<_script-contents_
    " & theScript & "
    _script-contents_"
    do shell script "cd " & theDesktop & "; osacompile -o 'forum test.app' -t APPL " & theScript -- make it
    </pre>
    Since just saving a script object by itself won't do anything (additional code will be needed to run it or call it from another script), the sample text is one of the tools I use to escape AppleScript text strings - it replaces the contents of the clipboard with the escaped text. To test with other script text, just copy the text to the clipboard, run the escape tool, and paste into the theScript variable.

  • Need To:  Keep Script Objects Unique to Specific Forms

    We create xdp's and then allow users to 'stitch' these together forming one complete PDF.
    These form's code check data entry, completeness, calculations, etc. One of its biggest features is that it highlights required fields (not the built in required field highlight) and conditionally required fields as needed.
    Global Functions (using a script object) works wonders onimmediate form feedback to the user. However, when we combine 2 or more xdp's together, the script objects disappear - leaving the first form's script object only.
    We need the script objects to stay unique to each form without 'dropping off' after stitching forms together.
    Any ideas??

    I would probably use a TreeMap that referenced the counter.

  • How to call a function from a different script object?

    Hi All,
    Here is the scenario,
    I have 2 script objects A and B .
    In script object A i have a function called "funcA" and
    in script object B i have a function called "funcB"
    Now I want to call funcA from funcB which is not happening.
    I tried doing
    A.funcA();
    inside funcB , but not able to access.
    Kindly help.
    Thanks
    Abhiram

    Hi Abhiram,
    Just a guess - try including the root node/node reference above the script object.
    form1.A.funcA();
    What does the JavaScript Console say when firing the function? Are there any errors?
    Your script objects can contain multiple functions. So you could move funcA() and funcB() into the same script object. This will make it easier.
    Niall
    Assure Dynamics

Maybe you are looking for

  • Import swf files in CP3, but export without any voice?

    Did anyone have the same problem with me? I imported swf file in slide and published. But I can't hear any voice in the slide.... At the same time, I tried to import as flv file and published, then it works. Voice in slide can be heard with no proble

  • Apple TV Air Tunes error -15000

    Since I have installed iTunes 8 my apple tv has been acting very strange. Has anyone else noticed? It seems to be slower, it has crashed once or twice, the last time it crashed It blew away all my content. I had to re-sync my photo's etc.. But my mai

  • How do I get rid of the "plus" cursor in numbers?

    I am working in numbers and having trouble with creating hyperlinks. I was able to create links but now I have the "plus" cursor and can't get rid of it and it seems my hyperlinks don't work.

  • Regarding selfregistration...urgent

    i have the selfregistration feauture installed in my portal (its version 3.0.9) so when ever user comes and registers ,i want to associate him to a page created by me. how can I do this???. actually the portal gives its own page.i dont want that. i t

  • Convincing a SQL Servery guy on Advantages of using Packages

    Our Database Version:10g Release 2 To implement a functionality, i had to create 5 functions and four procedures(one being error logging proc). For modularity reason, I wanted all these functions and procedures to be in one single package. But my man