Show/hide multiple fields on list drop-down choice to help if else

Goal is to display or hide the three fields according to a choice of menu drop-down. If show X, hide if Y.

How a syntax on line error 6 when adding to the trigger mouse-to the top of the field drop-down list.

Are several actions allowed for each if condition?

if(event.target.value = "Yes")
  getField("Top_inches").display = display.visible;
  getField("Top_numerator").display = display.visible;
  getField("Top_denominator").display = display.visible;
else
  getField("Top_inches").display = display.hidden;
  getField("Top_numerator").display = display.hidden;
  getField("Top_denominator").display = display.hidden;

You have at least two syntax errors. The first is that you used the wrong operator for comparison. 'Is', not '=' (this is the value assignment operator).

The second is that you did not put blocks of code inside the curly braces.

If your code should be:

if (event.target.value == "Yes") {
    this.getField("Top_inches").display = display.visible;
    this.getField("Top_numerator").display = display.visible;
    this.getField("Top_denominator").display = display.visible;
} else {
    this.getField("Top_inches").display = display.hidden;
    this.getField("Top_numerator").display = display.hidden;
    this.getField("Top_denominator").display = display.hidden;
}

Tags: Acrobat

Similar Questions

  • Text of field force based on list drop-down choice

    I adapted this from an example provided by pguerett call 'health mental-check' (in another thread that I can't find right now) who performed a similar function based on a checkbox control.

    I have a dropdown list with a change event to set the menu text focus IF the drop-down list item is replaced by 'others '.

    In the text field, that I have an output event which 'should' give a popup message and then set the focus on the field from the drop-down list, IF the drop-down list item is "other", AND the field is null output.

    However, this does not go as planned.

    Any help would be greatly appreciated.

    Thank you.

    Part of it is to get your '=' and '==' mixed up. A = to assign the value, two == to compare a value.

    I think the gasket you need.

    I changed your script:

    var newValue = this.boundItem(xfa.event.newText);
    if (newValue == "Other")
    {
        xfa.host.setFocus(form1.IncidentReport.OtherNature);
    }
    

    I think the way it works is that you'll need to capture specific value selected in the drop-down list, because it is has been selected the value does not exist in the field again... or something like that - someone else here can probably explain it properly!

  • Insert the subform based on list drop-down choice

    Is it possible to insert a subform of a choice of menu drop-down. I have attached a sample of what I am trying to accomplish. When you select Yes in the drop-down list the subform becomes visible. What I want is when the selection is not, so there is no space between the next set of questions. This form extends on more than 5 pages.

    Can be done with the following steps.

    1 record under pdf dynamic rather than static.

    2. change work subform presence of Invisible to hidden (exclude from layout) in your form.

    Please check the pdf seal updated.

    Rambeau.

  • Show/hide video Clips with a drop-down list box. Help!

    Hi all

    I was hoping someone here could point me in the right direction with this.

    I have a combo box that loads data from an xml file I want to use to toggle the visibility of various clips on the stage.

    I should do in ActionScript (can I?) or should it be done in the components Inspector, or can it still be done this way.

    Thanks - snake

    The code below, there are three movieclips involved, with names of "mc1", "mc2" and "mc3" instance assigned to them as data value of each item of the combobox. The combobox control has an instance name of "cbox". In this case, given that the combobox control is the first item selected by default, the first movieclip, mc1, appears. If you study the code, you will come if all goes well to understand it enough for this model to your specific needs.

  • Using a choice of multiple words in a drop-down list field to launch a java script

    I'm a complete newbie to manuscript of java and relatively new to your building in Acrobat.

    I use a drop-down list field to fill in automatically other fields based on my 1st drop-down list selection.

    The 1st field drop-down allows me to select a variety of suppliers.  Once I have selected the vendor, he auto-remplit the coordinates for this provider.

    I've plagiarized the writing of scripts from this link: https://acrobatusers.com/tutorials/change_another_field.  I even changed my domain names for the moment.  I'll change my return form field names and the script to match once I got it working like I want.

    If I use only one name in my drop down list provider (1 field), the script works perfectly and auto-remplit contact as expected information.  However, many of my suppliers are two words or more... and I need those names in print, so I can't do just a contraction of a Word.  Here is the script I use:

    Here is an example of a supplier of single word name that works as expected:
    Put all vorkriegsbevölkerung data in a single data structure
    var DeptData = {ADLEMI: {contact: "P.O. BOX 2371",}}
    E-mail: "DOWNEY, CA 90242."
    {{deptnum: "PHONE: (562) 923-0333 FAX: (562) 923-8111 '}};
    function SetFieldValues (cDeptName)
    {
    this.getField("DeptContact").value = DeptData [cDeptName] .contact.
    this.getField("DeptEmail").value = DeptData [cDeptName] .email;
    this.getField("DeptNumber").value = DeptData [cDeptName] .deptnum;
    }

    Unique provider name, I used in the example above is "ADLEMI."  If I add 'BEST' to ADLEMI (see below), I get a syntax error.  I really need to be able to use several words in my list drop-down provider to trigger auto-fill.

    Put all vorkriegsbevölkerung data in a single data structure

    var DeptData = {ADLEMI BEST: {contact: "P.O. BOX 2371",}}

    E-mail: "DOWNEY, CA 90242."

    {{deptnum: "PHONE: (562) 923-0333 FAX: (562) 923-8111 '}};

    function SetFieldValues (cDeptName)

    {

    this.getField("DeptContact").value = DeptData [cDeptName] .contact.

    this.getField("DeptEmail").value = DeptData [cDeptName] .email;

    this.getField("DeptNumber").value = DeptData [cDeptName] .deptnum;

    }

    The only difference is that I added a space and the word 'BEST' after ADLEMI.  Is there a way to get around this.  I need to have several words in my drop-down list, or at least the full name of the vendor indicating in the field when I print it.

    Thank you

    Place quotation marks around the name of the element.

    Monday, April 13, 2015, at 17:29, bpwhistler, [email protected]>

  • List drop-down selection trigger change in the text field

    I'm hit a roadblock here. I'm on Adobe Acrobat XI and here's the scenario: I have a list box and a text box.

    Drop-down menu field has 3 caps (A, B, C).

    If A is selected, the text box = 15 default, but has the ability to change in the text box.

    If B or C is selected, the text box = 0 or "by default, but it has the ability to change in the text box.

    If I use an if/then with a .value, I'll be able to get the numbers to work, but do not have the ability to edit and keep them there. If I enter another number in another area, the JavaScript code will run and change the text box to 0 or 15.

    Any help would be greatly appreciated.

    Thank you

    Instead to use script logic for the text field, use the drop-down validation script. In this way, that it only will be triggered when you change the value in the drop-down list field, not when you change any field in the file (as the calculation script).

  • Hi, PDF form of the guru. How to make a text box become a required field IF a drop-down list is selected as the "Yes"?

    Hi, PDF form of the guru.

    How to make a text box becomes a "required field", IF a drop-down list is selected as the "Yes"?

    and 'not required' if the drop down menu selected as 'No' or left blank.

    Any help would be greatly appreciated

    see you soon

    Use this code in the custom drop-down list field validation script:

    this.getField("Text1").required = (event.value == "Yes");

    (Change "Text1" to the actual name of your text field, of course)

  • ADD ITEMS TO THE LIST DROP-DOWN LIST TO A TEXT FIELD (USER ENTERS THE ITEM) AND ALSO RELATED TO VALUE

    Untitled.jpg

    I have WANTED to ADD of ELEMENTS from the list drop-DOWN OF THE AREA of TEXT (the ELEMENT NAME) WHERE the USER BETWEEN of THE DESCRIPTION of POINT

    AND RELATED value SHOULD ALSO BE ADDED to THE SAME ELEMENT.

    LIKEWISE REMOVE ITEMS IN THE DROP-DOWN LIST

    PLEASE GIVE SHAPE TO SAMPLE OR JAVASCRIPT FOR THE ABOVE SCENARIO...

    INDEED USEFUL FOR MY PROJECT PLEASE SEND PDF FORM

    Hi Praveen,

    You can add items to the list in a specific order, which would be to load the elements in an array, sorting and then load in the dropdown list drop-down list.  This would be in the click event of the button Add.

    Create a table to hold all the list items, table drop-down list contains objects with a property 'displayItem' and 'value '.

    dropDownItems var = [];

    Add the new

    dropDownItems.push ({displayItem: ItemName.rawValue, value: BoundValue.rawValue});

    Add existing ones

    for (var i = 0; i)< dropdownlist1.length;="">

    {

    dropDownItems.push ({displayItem: DropDownList1.getDisplayItem (i), value: DropDownList1.getSaveItem (i)})

    }

    Sort by ascending order of displayed text

    () dropDownItems.sort

    function (a, b)

    {

    If (a.displayItem< b.displayitem)="" return="">

    If (a.displayItem > b.displayItem) return 1;

    return 0;

    });

    clear all items

    DropDownList1.clearItems ();

    load the sorted items

    for (var i = 0; i)< dropdownitems.length;="">

    {

    var dropDownItem = [i] dropDownItems;

    DropDownList1.addItem (dropDownItem.displayItem, dropDownItem.value);

    }

    clear the fields of the source

    ItemName.rawValue = null;

    BoundValue.rawValue = null;

    I added a button 'Add' sorted in my sample https://workspaces.acrobat.com/?d=OwysfJa-Q3HhPtFlgRb62g

    Concerning

    Bruce

  • Curious problem with lists drop-down and put in page sank

    Hi - I have a form (I hope to become a series of forms) which has a provision passed which works very well. I presented a drop-down list that is populated from an XML data file. The user selects the item in the drop-down list and the result of the forces of the name in another text field, and the address in a different text field. To get the XML code embedded, I entered in Acrobat and imported the data file in the form - this allows activate me drive (using LiveCycle Reader extensions) and everything works fine, except for the odd behavior: the drop down menu fills the text fileds as expected, but as soon as I'm in the first fluid text box 12 Add text, and to expand the box, fields of text data population becomes empty. The user would be in a situation where they would have to fill all fluid areas before their choice in the menu dropdown. I want that text fields populated by drop down menu to stay populated.

    I tried to give the fields this script to the output:

    setItemState (i

    it's true )

    What is the connection defined for fields that disappear? Look at the link in the object palette tab.

    Paul

  • Problem of not seeing list drop-down connection to the wireless network when checking connections network - pc windows 7.

    Problem of not seeing list drop-down connection to the wireless network when checking connections network - pc windows 7.

    I just installed a Belkin modem-router - which went well. Can I connect WiFi gadgets etc. I can also connect to the internet via a network cable to my pc. I also installed a belkin usb wireless adapter and in Device Manager, says it is enabled and works.

    My problem is, I have no way of choice get a WiFi PC to display in the list (from the notification area) and cannot get the pc to give me options to create a wi - fi connection. The more I get to try to do that is "unexpected error"!

    If someone could help on this - I would be very grateful

    Good news - update of my ongoing saga with this Belkin modem/router.

    Got the pc to see wi - fi now. It turned out to be the Zone Alarm! As the router has a firewall, I uninstalled Zone Alarm completely. Also, I went into the properties of belkin usb and checked it was the most recent drivers, it does not so I installed them.

    So far so good

    Thanks for the help

    TREV Smith

  • My Panel of libraries is missing from the drop down window. Where can else I access it? Is this normal?

    My Panel of libraries is missing from the drop down window. Where can else I access it? Is this normal?

    Lisa,

    Please check if the AI CC 2014 update is applied or not. Check the desktop creative cloud for all application pending update.

    Thank you and best regards,

    Mohit Gupta

  • Showing and hiding of multiple tables with a drop-down list

    I'm doing a drop-down list so that users can select the number of tables that are shown/generated when they specify the tables how they need to complete (there is 1 table for each day of a multi = day, maximum of 5).

    I thought I would use a similar javascript than I used in another place on the form that has been applied to radio buttons to show or hide a specific table. When I applied that to the drop down and added more than lines that the scipt was ineffective, with some play that I managed to do the work, but now it seems thre is a question with which value is selected in the list. When a user selects a certain value, it shows the previous value (so when I chose 4 days, which has a hairy '3', the message box for the test proposed, I added told me I selected the value '2').

    I wonder if there is an easier way to do the function, what I'm doing, or if the drop down menu is the best solution? The maximum number of tables that can be filled is 5, then the drop down menu appears as a way ideal for resticting than for the person filling out the form.

    This is an example of writing, that I joined the drop-down list, as an action of "change." It is repeated 4 times for each value.

    Form1. Page2.DropDownList1::change - (JavaScript, client)

    If (this.value == '2') {}

    Form1. Page2.TableDay1.presence = "visible";

    Form1. Page2.TableDay2.presence = "visible";

    Form1. Page2.TableDay3.presence = 'hidden ';

    Form1. Page3.TableDay4.presence = 'hidden ';

    Form1. Page3.TableDay5.presence = 'hidden ';

    }

    else {}

    Form1. Page2.TableDay1.presence = 'hidden ';

    Form1. Page2.TableDay2.presence = 'hidden ';

    Form1. Page2.TableDay3.presence = 'hidden ';

    Form1. Page3.TableDay4.presence = 'hidden ';

    Form1. Page3.TableDay5.presence = 'hidden ';

    }

    If (this.value == '3') {}

    Form1. Page2.TableDay1.presence = "visible";

    Form1. Page2.TableDay2.presence = "visible";

    Form1. Page2.TableDay3.presence = "visible";

    Form1. Page3.TableDay4.presence = 'hidden ';

    Form1. Page3.TableDay5.presence = 'hidden ';

    }

    else {}

    Form1. Page2.TableDay1.presence = 'hidden ';

    Form1. Page2.TableDay2.presence = 'hidden ';

    Form1. Page2.TableDay3.presence = 'hidden ';

    Form1. Page3.TableDay4.presence = 'hidden ';

    Form1. Page3.TableDay5.presence = 'hidden ';

    }

    I looked at it and tried a few different things and my colleague who is much better than me with sciprting is also at a loss for now - he is unfamiliar with LiveCycle, unless I have so any help is appreciated. Thanks a lot once again as my last number (the script for radio buttons) has been resolved here. Thanks again.

    The question that you see with the value being off is due to the fact that you use the change event. The change event is triggered * before * the new value is assigned to the field. This event is commonly used for intercpet changes. If you wish to continue using the change event, you can get the new value with:

    xfa.event.newText;

    This, however, will get the text that is displayed instead of the value behind. No doubt, you can consult the nodes in the drop-down list to see what value, but I think you should just avoid all of this by adding your code to the layout event: each subform hideable... loan for example, for the first, in the case of TableDay2 layout_ready (as the day1 should never be hidden, as I understand it) put :

    This.Presence = (DropDownList1.rawValue > = 1)? "visible": "hidden";

    TableDay3 would be:

    This.Presence = (DropDownList1.rawValue > = 2)? "visible": "hidden";

    etc.

    Let me know if it helps.

    -Scott

  • Hide text in the field when the drop-down list is selected

    Hello, I am looking for a way to hide text in a text field when a number is from a drop-down list. For example, I have a table with text field that have a line pre-populated text in them. I would like the text to be deleted if 'Yes' is selected in a data entry drop-down list in the text box empty now.   Here's what I have so far:

    If (this.rawValue == 'Yes') {SubStandard_A.StandardPkgTbl.Row1.TextField2.rawValue == ' ' ;}}

    I tried .rawValue == "", .rawValue == null, .clearItems

    Any help is greatly appreciated!

    Hello

    Just spotted your original script had a double == when assigning the value to the rawValue. You must use the double == equality test.

    Here is a sample.

    We hope that make you it work.

    Niall

  • Hide several pages unless the drop-down list is selected

    Hello

    I have a 4-page form that I need to be able to hide 3 of 4 pages until a selection is made from a drop-down list on the first page box. So I have, for example, the pages marked:

    Page 1

    Page 2

    Page 3

    Page 4

    I have a drop down list which has

    Page 2

    Page 3

    Page 4

    for options and if no selection is made only Page 1, will be visible. If the selection is Page 2, I wish that all pages except page 2 to be hidden and only see page 2, did not 4 pages show and only show Page 2 fields.

    Does anyone know how to do this?

    Thanks in advance for any idea!

    The only downside to the activation of your condition is that the first page of the form can not be deleted. If you set page 1 "Hidden" will be hidden objects on the page, but the page itself will remain in the form that is displayed as a blank page.

    Attached shows a form with page 0-4 (5 pages). A drop down menu on page 0 and it controls the rendering of pages 1-4.

    Steve

  • How to make the fields from the drop-down list required to make a selection before you save a PDF file

    I have a PDF form where I entered a JAVA script in some areas by using the option ON BLUR under 'Actions' and it works very well to prevent users to go to another site if they leave the field with the empty JAVA Script in place.

    My question is that I have other form fields that have a drop down menu where they can choose several options. I would also like to make these fields to where they can't move forward on the form unless they choose an option in the list. However, because with the option in the list "choose a ' is a default option entered into the field (field is not empty), script JAVA of BLUR ON option I used in my empty fields does not work to block the user to move beyond the matter without selecting an option. They are able to save the form with all the drop down menus staying to 'pick '.

    I made the field "Required fields" then they are highlighted with the red area around, but is there another tool to force them to choose an option for each in the drop down menus before you save the form, instead of being able to save with leaving the 'choose One' in the field by default?

    The best way to do this without knowing the default value of the field is to compare the value of the field to the default value of the field... You must make sure that your default value is not part of the possible acceptable answer. It works with most of the field types that a user can fill.

    If (event.value! = event.defaultValue) {}

    do something;

    App.Alert ("required field not completed. \nField name: "+ event.target.name, 1, 0);

    }

Maybe you are looking for