Help select the value from a drop-down list box

Hello

I develop a script (in JavaScript) which will allow a user to select an export PDF presets (that are loaded in a drop-down list) and then export the InDesign file to PDF, by using the selected PDF preset.

I have the combo fill properly and I am also able to export to PDF correctly, however I have a problem setting the preset has been selected by the user. Here are some of my code fragments:

Drop-down list:

with(borderPanels.add()) {

     pdfDD = dropdowns.add();

     sl = new Array();

     for (i = 0; i < app.pdfExportPresets.length; i++)

     sl.push(app.pdfExportPresets[i].name);

     pdfDD.stringList = sl;
     pdfDD.selectedIndex = 0;

}

 

...

 

myPreset = pdfDD.selectedIndex;

In PDF format:

    // Open, Export, & Close
    for (i = myFileAmount; i >= 0; i--) {
        app.open(File(myFolderContents[i]));

        createHyperlinks();

        app.activeDocument.exportFile(
        ExportFormat.pdfType, File(myFolder.fsName + "/" + app.activeDocument.name.split(".indd")[0] + ".pdf"), false, myPreset);
        app.activeDocument.close(SaveOptions.no);
    }

During the passage of myPreset, it is defined as 6 (the index from the drop-down list).  How can I set myPreset that the real value of what has been chosen?

Thank you!

In view of your code, you probably need something like:

myPreset = app.pdfExportPresets.itemByName (pdfDD.stringList [pdfDD.selectedIndex]);

@+

Marc

Tags: InDesign

Similar Questions

  • How to change the items in a drop-down list box that is part of an array of clusters

    Hello

    In the attached vi, I have an array of clusters and each cluster contains two drop-down list boxes. How can I edit the items in the drop-down list box 1 for all elements in the array? (All elements of list box 1 has the same elements.)

    By way of illustration, I have also included the case of trivila, for example, edit the items in a separate drop-down list box that is is not part of an array of clusters (combo box 3). Please notify. Thank you.

    Peter

    Right click on the drop-down list box and select Create-> Node-> String() property. Place it on the block diagram. Change to write (right click) and then feed him an array of strings.

  • Modification of the properties-type def drop-down list box

    I have a group of 32 cases of a def type. The def type contains several different types of control. What I have to do is to change the properties of the list box for each of the type defs. Normally, I would create an array of references to change the properties for each of the type defs, but when I try this I can not access the properties of string [] for combo box selections. The only way I found to fix it is to create a reference for each individual drop-down list box item. It is labour, since I'll have 32 elements. Is there a way to beeter to do this? The first screenshot shows the issui I'll have, not being able to change the properties of specific elements within each of the def type at runtime through a control [] array. The second screenshot shows the only solution I've found so far, which is not very practical.

    You will need to set up (for a more specific class) control to a type of combo box for the particular control [] index that has the combobox control if you want to access the drop-down list.

    You can also access the combobox in a cluster based directly, rigth click on the control reference and a link to the element cluster directly.

    The last option is to make the strictt of typdef will fill all instances with the channel list [] given that it is a strict property.

    the approach is based on the weather, you plan on changing the list during execution.

  • Make visible or invisible drop according to the value of another drop-down list. Help!

    Hello

    I need to create the following form... I want to choose at the beginning of the shape between 3 options (imagine: 'Opt1', 'Opt2' and 'Opt3'). And after that, I would like to make visible 10 different lists. I mean, if I choose 'Opt1', 10 drop-down lists related to 'Opt1' will become visible (the drop-down list together, including the text of the title and the clean drop-down list). Otherwise, if I choose 'Opt2', 10 drop-down lists related to 'Opt2' will become visible and the same 'Opt3 '.

    This problem, which seems to be very easy to resolve, it is impossible for me. I have read hundreds of forums and manuals, but I can't find the solution. I tried with several thousands of events, but I can't do the form works as I want... So, please, can someone help me?

    Thank you very much.

    Hello

    Here is an example. The script is located in the event of changing the drop-down list. The easiest way is to group your drop-down menus in subforms, then simply script for the visibility of three subforms, instead of 30 drop-down menus.

    The script focuses on the choice of the user and changes the visibility by using a switch statement. One if exposed to the exit event would work as well.

    switch (xfa.event.newText)
    {
         case 'Option 1':
              option1.presence = "visible";
              option2.presence = "hidden";
              option3.presence = "hidden";
              break; 
    
         case 'Option 2':
              option1.presence = "hidden";
              option2.presence = "visible";
              option3.presence = "hidden";
              break; 
    
         case 'Option 3':
              option1.presence = "hidden";
              option2.presence = "hidden";
              option3.presence = "visible";
              break; 
    
         default:
              option1.presence = "hidden";
              option2.presence = "hidden";
              option3.presence = "hidden";
              break;
    }
    

    Note that all three subforms are hidden in Design view. The drop-down list choice makes the appropriate subform visible.

    In design mode, you can select a subform in the view of the hierarchy and in the object/field tab change its visibility to visible, if you want to work on it in the design.

    Hope that helps,

    Niall

  • Selecting a value in a drop-down list returns to an incorrect value

    Hello

    I have a table with drop-down lists in a column. The drop-down list provides 3 values: Yes, no and s/o. When the user selects n/d and leaves the cell, the value changes to no.

    Any thoughts on what is the cause and how to fix it?

    Thank you

    MDawn

    You can set the same value for two choices in the drop-down list. This is why it is failing the first condition in the list with the same value...

    Or

    You could not give the values for the items in the list... In this case, as they both start with "N", it will highlight the first item that starts with "N"...

    Set different values for each element in the binding tab, then click on specify point values.

    Thank you

    Srini

  • Select the point in combobox/drop-down list, fields to update

    Hello

    I have a drop-down list. When a user makes a selection, I would like to query a database and return the results to be displayed in a form. Note, I don't want users to have to press a button, it should happen when an element is pressed. It sounds simple enough, but because I'm new, I'm fighting.

    I understand that I need to create a 'change' and then Manager in this handler, I need to run my t service get the data, but then when I try to access these data, nothing happens. I have to Bind something to the combobox? Here is my code.

    "" < s:ComboBox id = "lcidComboBox"change = "lcidComboBox_changeHandler (event)" labelField = "name" selectedItem ="bills.locn{}'> "

    " < s:AsyncListView list =" getLocationsResult.lastResult{}"/ > "

    < / s:ComboBox >

    protected function lcidComboBox_changeHandler(event:IndexChangeEvent):void

    {

    getLocationsResult.token = locationService.getLocations ();

    trace (locations.snam); <-this is not anything!

    }

    See you soon,.

    Brian

    OK, think about it. I needed to include a tag Binding then call my answering machine, the object is able to be called and I can view its properties.

    protected function lcidComboBox_changeHandler(event:IndexChangeEvent):void

    {

    getLocationsResult.token = locationService.getLocations ();

    snamTextInput.text = locations.snam;

    cuidTextInput.text = locations.cuid;

    }

  • Make a field of text/hide according to the results of a drop-down list box

    Hello

    I wonder if someone could help me with this. I want to show/hide some text boxes in my form according to the choice made by the person filling in. For example, there is a dropdown list containing a selection of numbers 1-4. If 1 was selected, the text boxes below 1 would be visible and obligatory, if the 2 have been chosen, 2 text boxes below would be visible and required etc...

    I'm new to FormCalc (only started using it this morning), so simple a possible explanation would be fantastic.

    Thanks for reading!

    Of course, you can have javascript and formcalc in the form. Not only the two in the same field, same event; D

    Okey, let's try some things:

    (1) check if the "binding" from the drop-down list is the same as the values that you choose. In the script you are referring to the bound values.

    (2) other names for the Textfields would be better, because it is more difficult to refer to "Textfield1 [1]" then to for example: 'New '. I was just to lazy to give them names. (If it's on another page or subform, you refer to the fields correctly: as MyForm.FirstSubform.FirstTextfield... this name lies in the specific script field.)

    (3) check your script once more... want to make invisible mandatory fields?

    (4) check if your form is dynamic. (If it isn't you will not see the changes...)

    You should probably do it in small steps, such as:

    (1) first of all, you refer to areas such as:

    This.rawValue = Firstfield.rawValue;

    If the changed value fields got you its name and to be sure that the event you put is the right one.

    (2) try the different parts of the script and look at how it works. Problems can be more easily found and then

  • Command to refresh a calculated field when you select an option from the drop-down list box

    When my form user selects an option in a drop-down list box, the value in the field (in this case, Total) I would like to update, but it isn't.

    A radio button option box makes the Total-development field to automatic update when the user clicks on the radio button. But the drop-down list box is not updated Total (without clicking away from the field). I would like to add a command in the Combo Box to refresh the Total field when you selected the option to drop-down list box.

    Someone at - it a code (Javascript?) to get there.

    Thank you very much.

    You don't need a script, simply select the 'Value selected to validate immediately' checkbox on the Options tab of the dialog list box drop-down list box field properties.

  • How to make a pdf that can send a form to e-mail selected in a drop-down list box?

    I'm trying to be able to create a user of a pdf file I created, select an e-mail from a drop-down list box and then hit send and have it send to this email address that has been selected.

    Thanks for the help!

    Hello

    I don't think (maybe wrong) you can do this in InDesign. At the very least, you could draw the shape in InDesign, but I guess that the interactivity between the selection of the list and the action of mail should be done with Scripting Acrobat or LiveCycle Designer if you have.

    FWIW,

    Loïc

  • Using Wizard of the Action to change the font in the drop-down list box

    Acrobat Pro DC on a MAC under OS X 10.11.6

    I have a form that is mainly created in Indesign (it works for us - I know that others prefer to locate forms purely in Acrobat).

    I have a script I can run through the wizard of the Action (run a javascript script) to change the font in all fields in text form. But being a novice script that I can not understand how to create a similar script that will change the font used by drop-down list boxes (created in Indesign). Is it possible by a script?

    I know I can do it manually through the properties, but if someone can give me a pointer to find a way to do it with a script that would be amazing!

    Thank you

    The script can be changed to:

    for (var i = 0; i)< numfields;="" i++)="">

    var f = getField (getNthFieldName (i));

    If (f.type = 'text' | f.type = "combobox") {}

    f.textFont = "Arial";

    f.textSize = "10";

    }

    }

    But now I have to ask, what are your reasons to use Arial instead of Helvetica?

  • channels drop-down list box

    I'm trying to get some combo boxes to have their entries populated by a text file. I have read many entries of forum on 'string []' property, but he refuses to work for me. I want the combo box is editable by changing the entries in a text file.

    Does anyone can beat this code into submission? I get this error message on a controller GPIB needing to be in charge.

    I've included the vi, the text file, I want to fill the combo box 'Version number' and that it should be.

    Tay

    You have several issues General, but here are the ones affecting your drop-down list box:

    1. In general, if you make copies of OR provided files, use new names.
    2. The VI you changed to read strings from the worksheet is bad DEFAULT.  You have the number of lines, by default 4 and start playback offset set by default to 132.  You get the error is because the file is not 132 bytes of data.  Definition of those to-1 and 0, repsectively will remove the error.  You should do this by opening the VI, change the value, then right-click and select "Data management"-> "Make current default value" for each of the two controls.
    3. Now, the VI you properly load the values in the file.
    4. There is no reason to replay the file whenever the user changes the value of the drop-down list box.  Read once at the beginning of the program.
  • How to populate a drop-down list box itemEditor

    Hi all

    I have a DataGrid where one of the columns is a drop-down list box. I use a component itemEditor for the drop-down list box. I guess that's the best practice? I have an arrayCollection collection in my application I want to use in the itemEditor, but I'm not sure how to pass data to the component. Here is my code. Any help you could provide on how to do this would be greatly appreciated.

    Answered my own questions.

    Just need to add the result to my model object and then use it as my dataprovider.

    DOH!

  • DROP-DOWN LIST BOX STRING

    Hi all

    The string that is displayed in the drop-down list box is on the left side, is there a method to move it to the Center.

    without spaces before the string in the edit points.

    The image is attached below

    Hello Shrekt,

    set the focus on your drop-down list box (click on it) and then change its text properties.

  • Automatically populate a drop-down list by using another selection from the drop-down list box

    New java/preparation forms so I apologize in advance.

    I currently have a menu drop-down box 1 (Occupation) with three options: "enter your own description/blank", retired housewife. When someone chooses either retirement or anyone at home, I would another drop box 2 (employer) to assign automatically "n/a. . The employer drop box has only two options: "enter your own/blank", N/A.

    Far, I could for that box to fill but only when the person clicks in the box (as if they were about to enter their own text.) Then only it will fill the drop-down list "employer." I would like it auto fill once the person has chosen retired, Virgin or stay-at-home woman without having to enter in the box (just using the arrow to the size of the drop-down list box).

    I currently have a key shot that resets the employer box when a person chooses the option vacuum/enter your own option. I then a JavaScript (only for the housewife now) that only works if you click the box of. Key combination works I want to than the other options work as well. If the client settles on white, the choice of the employer updates automatically empty without having to click in the box of. Any help (including general advice to make my code cleaner) is very appreciated!

    Current script of typing:

    If {(event.willCommit)

    If (event.value == "") this.resetForm (["use"]); of other SetFieldValues (event.value);

    }

    The current upward, mice running JavaScript :

    var v = this.getField ("Occupation") .value

    If (v is "Housewife")

    1. this.getField("Employer").value = "N/a".

    I think maybe I should use event.willCommit in my formula, but I'm not sure how to include it.

    Thank you!

    I would not use the key sequence or MouseUp actions for this, but the action post.

    Just make sure that you set the field option to validate the selected value immediately (under Properties - Options) and then use this code as the custom validation script:

    var employerField = this.getField("Employer");
    if (event.value=="Homemaker" || event.value=="Retired")
        employerField.value = "N/A";
    else employerField.value = employerField.defaultValue;
    
  • Slide to pause until that value is selected from a drop down list?

    Hi there everyone.

    I try to create a cover page of sorts for a simulation of system where the user is asked to enter his name and choose where they work in for a combo box (using the drop-down list box widget)

    I have the name entry part work and the drop-down list box is displayed, but I'm having some problems with it.

    First of all, as soon as a value is selected in the box is jumps to the next slide. I would have rather navigation controlled by a button that the user can make sure that they have chosen the correct value before continuing. Is there a way to do this?

    Hello

    This is the craziest question, but think I found the reason: Although the widget looks a lot smaller in edit mode, when opening it (preview or published) it falls above the button. When I have it away, seems to work. Can you confirm?

    Lilybiri

Maybe you are looking for