Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: JS Form Help

  1. #1
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Cool JS Form Help

    First, let me say that I'm using the built in JS in adobe acrobat x standard, this is important because theres limited functionality with this that needs to be understood before a solution can be determined.
    My problem is the following:
    I'm building a form, the simple version is that when a user selects an item from a dropdown box that inturn updates several text fields with data related to the choice they made. Seems simple right? The coding is very simple with this setup, and if you're familiar with the JS in adobe then you know I'm using the calculate JS function to do all this work.
    The catch is the following:
    using: if (this.getField("dropdown1").value = "abc") event.value = "xyz";
    the problem with this is that these two fields now linked, the text box is always displaying xyz regardless on what the dropdown reads and after an extra click it will even reset the dropdown to read as "abc".
    Also, after this value is assigned no conflicting arguments are allowed and thus the text field gets locked in with the data regardless.

    I was wondering if any of you fine programmers out there know a work around for this. I appreciate any help on the matter.

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Location
    London
    Posts
    152
    Thanks
    4
    Thanked 42 Times in 42 Posts
    Well, I haven't done programming in Adobe Acrobat, but looking at the code snippet you provided, shouldn't it be == sign rather than =
    Code:
    if (this.getField("dropdown1").value = "abc") event.value = "xyz";
    should be
    Code:
     if (this.getField("dropdown1").value == "abc") event.value = "xyz";
    Just a guess though...

    And event (in event.value) is a textbox or inbuilt variable ?

  • Users who have thanked niralsoni for this post:

    Riaetion (06-24-2013)

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,479
    Thanks
    6
    Thanked 981 Times in 954 Posts
    No, it should even be
    Code:
    if (this.getField("dropdown1").value === "abc") event.value = "xyz";

  • Users who have thanked VIPStephan for this post:

    Riaetion (06-24-2013)

  • #4
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    resolved

    ^the above and a rather important checkbox later solved my problem. thanks all!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •