Get the value of the drop-down list (selectedIndex) and the text field - does not

Hi all

I'm trying to find and change the values selected by the user using a drop-down list and text field. Here's the code.

ChangeRevDetails();
function ChangeRevDetails(){


          var myDialog = app.dialogs.add({name:"Enter copyright information"});


//    var monthlist = col1.dropdowns.add('myList', undefined, myList);


          var col1 = myDialog.dialogColumns.add();
          var col2 = myDialog.dialogColumns.add();
  
    col1.staticTexts.add({staticLabel:"Month:"});
          col1.staticTexts.add({staticLabel:"Year:"});
    col1.staticTexts.add({staticLabel:"Rev. no.:"});
    
    var myList = [ "January", "February",  "March", "April", "March", "April", "May", "June", "July", "August", "Sepetember", "October", "November", "December" ];


     var myMonth = col2.dropdowns.add({stringList:myList, selectedIndex:0, minWidth:100});//{minWidth:100});
     var myYear = col2.textEditboxes.add({editContents:"2013", minWidth:100});   
     var MyRev = col2.textEditboxes.add({minWidth:100});


    var RevMonth = (myList [myMonth.selectedIndex]);
    var RevYear = myYear.editContents;
    var RevNumber = MyRev.editContents;
    var RevToReplace1 = RevMonth +", "+ RevYear;
    var RevToReplace2 = RevMonth +", "+ RevYear + " Rev. " + RevNumber;


    var myResult = myDialog.show();


        if(myYear.editContents == "") //entry is "" 
        { 
        alert("Please enter some text into the contents field."); 
        ChangeRevDetails(); 
        }
        else if(myResult == true) //user entered datas 
        { 


            alert (RevMonth);
            alert (RevYear);
            alert (RevNumber);
            alert (RevToReplace1);
            alert (RevToReplace2);


            app.findGrepPreferences = NothingEnum.nothing;
            app.changeGrepPreferences = NothingEnum.nothing;


            // grep find/change
            app.findGrepPreferences = app.changeGrepPreferences = null;       
            app.findGrepPreferences.findWhat = "[\\l\\u]+?\\s?\\d{4},?\\s+[\\l\\u]+\\.*\\s+\\d+";
            app.findGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item("Back page"). paragraphStyles.item("Legal_7/9");
            app.changeGrepPreferences.changeTo = RevToReplace1;
            app.changeGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item("Back page"). paragraphStyles.item("Legal_7/9");
            app.activeDocument.changeGrep();


            app.findGrepPreferences = NothingEnum.nothing;
            app.changeGrepPreferences = NothingEnum.nothing;
  
    } 
    else //implies user clicked cancel 
    { 
    myDialog.destroy(); 
    }


}

The problem is, it does not take the value that the user selects in the drop-down list and the text field. It takes the default value as "January" and the year is '2013' as these two values are given as selectedIndex:0 and editContents: "2013". I compared the coding with a few other scripts work as well, but it does not work. I added several alert boxes to check the value we get.

In addition, search for it and change also does not work. Please help me on this. Thank you.

Kind regards

Bachi. D

Change the order of dialogresults:

...

var myYear = col2.textEditboxes.add ({editContents: "2013", minWidth:100});})
var MyRev = col2.textEditboxes.add({minWidth:100});)
Ditto var = myDialog.show ();
    If (myYear.editContents == "") //entry is «»
    {
    Alert ("Please enter a text in the content field.");
    ChangeRevDetails();
    }
    else //user entered if(myResult == true) datas
    {
var RevMonth = (myList [myMonth.selectedIndex]);
var RevYear = myYear.editContents;
var RevNumber = MyRev.editContents;
"var RevToReplace1 = RevMonth + ', '+ RevYear;

"var RevToReplace2 = RevMonth + ', '+ RevYear + 'Rev' + RevNumber;

...

did not have a look for the problem of change to find

Tags: InDesign

Similar Questions

  • Select from the drop-down list point based on text box is not empty not

    Hello. I have a javascript code to click a button and it will insert the date in a text box named "Controller_PDF_Creation_Doc_Control_Date" in my form. I also have a drop-down list called 'Release_Approval_Initials '. Everything I'm doing is when there is a date of entry in the text box, I want that the 'Release_Approval_Initials' of the menu drop-down default by selecting the option "TM". The drop-down list is filled dynamically too. How can I do this? Here is the code I have.

    < SCRIPT LANGUAGE = "JavaScript" >

    verify() {} function

    var partNumber = ";

    var ecoNumber = ";

    var pdfDate;

    var queue;

    var queueValue = ";

    var allArray = document.getElementById('listofids').value.split (",");

    var error = false;

    for (var i = 0; i < allArray.length; i ++) {}

    pdfDate = document.getElementById('Controller_PDF_Creation_Doc_Control_Date'+allArray[i]).value;

    <!-document.getElementById ('Controller_PDF_Creation_Doc_Control_Date1') .value =' 19 / 08/11 '; ->

    queue = document.getElementById ('Release_Approval_Initials' + allArray [i]);

    queueValue = tail [queue.selectedIndex] .value;

    If ((pdfDate! = '' & & queueValue == '') |) (pdfDate == '' & & queueValue! = '')) {

    error = true;

    ecoNumber = document.getElementById('ECID'+allArray[i]).value;

    partNumber = document.getElementById('Part_Number'+allArray[i]).value;

    Alert ("You must enter a date of authorization to create PDF or Doc Control files and the queue to release for ECO" + ecoNumber + "part number:" + partNumber);

    }

    }

    {if (Error)}

    Returns false;

    }

    else {}

    Returns true;

    }

    }

    < /script >

    "< cfinput type ="Text"name =" "Controller_PDF_Creation_Doc_Control_Date #ItemID #" id = "Controller_PDF_Creation_Doc_Control_Date #ItemID #" value = "#DateFormat(Controller_PDF_Creation_Doc_Control_Date,"M/D/YY")" # "size ="12"maxlength ="8"validate ="date"required ="no"message ="you must enter a valid date in the format m/d/YY in the creation of PDF files or Doc control Date">"

    < cfinput type = "hidden" name = "today_date" id = "today_date" value = "#DateFormat (now ()," D/M/YY")" # "/ >"

    < input type = "button" value = "today's Date" onclick = "document.getElementById('Controller_PDF_Creation_Doc_Control_Date#ItemID#').valu e = document.getElementById ('today_date') .value" >

    < select name = "" Release_Approval_Initials #ItemID # "id =" Release_Approval_Initials #ItemID #">"

    < option value = "" > < / option >

    < cfloop query = "ShowDataEntryInitials" >

    < option value = "" #Initials # ""

    < cfif initial EQ ReleaseInitials > selected

    < / cfif > > #Initials # < / option >

    < / cfloop >

    < / select >

    Any help would be greatly appreciated. Thank you.

    Andy

    I figured out how to make it work. I just had to add parentheses in the right places to make it work. Here's what I did:

  • Drop-down list data connection - several text fields-

    Hello to you all, guru out there. I'm new on Adobe LiveCycle, but I have some experience coding in other languages, but not of JavaScript and XML. Trying to get a user to select a client and then based on this selection, I want to return several address fields, a Contact name at the customer's location and a phone number. The data connection is an ODBC connection to our CRM software, and information are stored in a table. The user of the form will be our Service technicians, and the rest of the form will be a place to type notes about the service call. We just try to facilitate the choice of the customer for our Service technicians to rather than having to type all the information. I've searched the forums and the solutions that I keep coming across are values defined by the user in the drop-down list, I have not found an example that illustrates this with a data connection. I work from a return address field to a text field (using the command .rawValue), but I need to fill in some more information. Any guidance would be greatly appreciated.

    Thanking you in advance,

    SSCLadam

    THW way I did is to use two data connections. 1st one to fill the DDlist with a list of customers. In this one, I use simple bind to do the job. Then a 2nd connection that will extract the folder of figurines based on the selection of the DDlist. This requires the code a SQL DB to retrieve the appropriate record. To implement this data connection, I can use the provided column headers to bind columns in the fields in my form. Then when this data connection is open (I put to delayed opening) and it returns the file in question are bound fields get automagically populated!

    I've included a sample I created... .you won't have the Pb, but you can at least see what I did. The code is on the change event of the DDlist

    Hope that helps

    Paul

  • PDF document with the text field does not have to scroll down after being placed in InDesign

    Hello. I have a PDF form that has a text box. If people type a lot of text in there, a scroll bar appears so that someone who reads the form allows to scroll up/down in this text box to read all the data.

    I placed this PDF file in a new InDesign file. When I export a new PDF file, the text is still there, though, he is no longer scrollable. If I highlight the text in the box and drag my slider lower, I can highlight "invisible" text that matches the text that someone would normally scroll down to see.

    Is there anyway I can 'keep' scrolling form PDF > Indesign > new PDF?

    Original PDF form was made in InDesign. Thank you!

    The PDF file that has been placed in ID loses all interactivity and form fields. There is no way to do what you want.

    Bob

  • Hello experts, I use Adobe forms in SAP. My question is, is there a any restriction for additem keyword in JavaScript? I mean, even if I use the keyword additem to add the name and value of a drop-down list, it adds up to 10000 files only. Please s

    Hello experts,

    I use Adobe Forms in SAP.

    My question is, is there a any restriction for additem keyword in JavaScript?

    I mean, even if I use the keyword additem to add the name and value of a drop-down list, it adds up to 10000 files only.

    Please sugest

    A drop-down list is the bad INTERFACE design where an element can contain more than 100 entries. It is very good in tests, but absolutely unacceptable if the form must be used by a person busy doing their work. The choice of Acrobat forms are limited, but consider a list box. Despite this, there may be limits imposed by the system or the implementation.

    Better would be

    (a) stop filling after awhile the list and add an entry saying several elements not shown, running report or use better filter

    (b) be available for all filtering of course lists

  • How to choose a specific value in a drop-down list using javascript

    Hello

    I'm looking for a way to select a specific value in a drop-down list (the first value) using javascript? How would I do that? Thank you in advance.

    Here's how you can select the first item without having to know what it is:

    Set the value of the drop-down list to the first element cb1

    var f = getField ("cb1");

    var val = f.getItemAt (0, true);

    If (val) f.value = val;

    Change 0 to a different index if desired, or use-1 for the last item in the list. More information for the field getItemAt method is in the Acrobat JavaScript documentation.

  • I get the message: firefox does not when I try to browse the web sites

    For some time now, when I load a web site, it takes a long time to load and then I get the message: firefox does not, or long-running script and does not. This occurs on many web sites, and when that happens, it takes a long time to browse this web site. I also have this problem on other browsers. Any suggestions as to what might help? Thank you.

    Hello

    Many issues of the site can be caused by corrupted cookies or cache. To try to solve these problems, the first step is to clear cookies and cache.
    Note: This will be you temporarily disconnect all sites, you're connected to.
    To clear the cache and cookies to do the following:

    1. Click the menu button

      , choose historic, then "Claire recent history...". ».

    2. Under "Time range to clear", select "all".
    3. Now, click the arrow next to details to toggle the active details list.
    4. In the list of details, see the Cache and Cookies and uncheck everything.
    5. Now click on the "Clear now" button

    More information can be found in the article remove the navigation, search and download history on Firefox .

    This solve your problems? Please report to us!

    Thank you.

  • 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

  • What is the initial value of a drop-down list empty?

    I wrote a script to populate the items in a drop-down list but only if there is no existing entry.

    The problem I have is to acknowledge that the list is empty. I tried to test the value null (if dropdown.isNull = true) and test the

    rawValue = "" and a bunch of other things without good result.

    I don't know that it's easy, but apparently not for me.

    Thanks for the help!

    These commands to test the value selected by the user. As they have not chosen anything and yet they will not have a value.

    The command:

    DropDownList1.items.nodes.length

    This will give you the number of items in the DDlist. It is 1 based. Note that it will count all the elements that have been added to the drop-down list by the user.

    Paul

  • 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

  • Check generate some Comp based on the drop-down list box and the selection list?

    I currently have a dropdown list with the three sizing options in it. Then I have two check boxes, one is ticked ideally would create the model to its normal size composition and if other is checked that it would reverse the widthxheight in the size of the composition. Then below that I have a "Generate" button, I want to be able to click and according to my selections, it creates the model.

    Looks like I need a kind of if then statement, but I'm having a hard time putting the two together. See below what I have so far.

    There may be missing parts, but I have it all working in a decibel pallate currently. I don't have functionality related to a button again.

    Any help would be appreciated!

    (also I don't know how to format the script spread here so apologies for that)

    ---------------------------

    palette controls

    templateGen.VerticalCheckbox = new Object();

    templateGen.HorizontalCheckbox = new Object();

    set the values for controls

    templateGen.comLookup = new Object();

    templateGen.compLookup = 'Template1 ';

    templateGen.compLookup = "Template2";

    templateGen.compLookup = "Template3."

    function templateGen_getHashValues (hash)

    { // {{{

    var ary = new Array();

    for (k hash) {}

    ARY.push (Hash [k]);

    }

    return area;

    } // }}}

    menu "composition".

    var panelGrp1 = templateGen.palette.add ('Panel', undefined, 'Templates Comp');

    compGrp1 = panelGrp1.add ('group', undefined, 'List templates');

    compGrp2 = panelGrp1.add ('group', undefined, 'Orientation');

    compGrp3 = panelGrp1.add ('group', undefined, 'Generate');

    templateGen.compList = compGrp1.add ('dropdownlist', LIST_DIMENSIONS, templateGen_getHashValues (bapple.compLookup));

    templateGen.compList.helpTip = "choose the type of desired here device model. All compositions are 60 fps. « ;

    templateGen.compList.selection = 'Template1 ';

    templateGen.compList.graphics.foregroundColor = darkColorBrush;

    templateGen.VerticalCheckbox = compGrp2.add ('checkbox', undefined, 'Portrait');

    templateGen.VerticalCheckbox .value = true;

    templateGen.HorizontalCheckbox = compGrp2.add ('checkbox', undefined, 'Horizontal');

    templateGen.HorizontalCheckbox .value = false;

    templateGen.generateBtn1 = compGrp3.add ('button', undefined, 'Generate');

    applyBtn.onClick =? ;

    When I work with drop-down menus, I always liked to tie the data they represent (like the width and height of the model in this case) directly to the elements.

    I run the code to really check, but it should work like this:

    -----------------

    Add models to your drop-down list and store the items in a table

    models var = [];

    models [0] = templateGen.compList.add('item','template1');

    models [1] = templateGen.compList.add('item','template2');

    models [2] = templateGen.compList.add('item','template3');

    set a width and height of each element

    models [0] .width = 1280;

    models [0] .height = 720;

    models [1] .width = 1024;

    models [1] .height = 768;

    models [2] .width = 1920;

    models [2] .height = 1080;

    Choose the item that should be selected by default

    models [0] .selected = true;

    applyBtn.onClick = function() {}

    read the width and height of the selected item

    var width = templateGen.compList.selection.width;

    var height = templateGen.compList.selection.height;

    {if (templateGen.VerticalCheckbox.value)}

    swap width and height

    var temp = width;

    width = height;

    height = temp;

    }

    now create your comp here with the given width and height

    }

  • Simple javascript for the drop-down list IF, fills two different fields

    I don't write js, but can grasp what it did when I hang a sample edit and re - purpose. I have a form simple fax that already resets to the opening. Here's what I'm doing:

    User selects the sender's name in the drop-down list of about 15 (grow w / hour)

    Fill in the following text field "sender Fax #" with the number of direct fax (xxx-xxx-xxxx in the js) user

    Are also complete this later text field "sender Ph #" with the number of direct ph of the user (xxx-xxx-xxxx in the js)

    Here is an example which I believe works the way you want: https://workspaces.acrobat.com/?d=gZNDS8dQQNqvwocUufXHNQ

    You have to watch the fields to see how they are implemented and to study different scripts to see how it works. If you have any questions, post again.

  • Why don't I receive not all values in a drop-down list in OBIEE?

    Hello

    Why I don't receive all the data which is present in the tables.and there is no limit in the County of datas? and there at - it presents another way to get all the data in the drop-down list in the tables?

    Yes, there is an internal limit on the no. values that are displayed in the drop-down list on guests. I guess that its 256 in 10 g.

    To increase the limit, add entry in the instanceconfig.xml below:


    1000

    This will increase the limit of 1000 values in the drop-down list.

    Thank you

  • drop-down list dataProvider and an object of value

    I am filling a dropdown menu with values that are stored in an object of value.   I'm pulling the values from the table of a database vai SQLite the SQLResult object and they come as an array of objects of value. This is exaclty what I want, so I refer to those within a property of my object model and shipping and the event carrying this table.   I place the array of objects of value in a collection of table as follows:

    var dropDownListValues:ArrayCollection = new ArrayCollection(event.foodCategoryList);
    

    Try to access it via a drop-down list lists dataProvider property as follows:

    foodCategory.FoodCategory_DropDown.dataProvider = dropDownListValues;
    

    My drop-down list then displays

    [object Object]
    [object Object]
    [object Object]
    [object Object]
    [object Object]
    [object Object]
    

    My dropDownListValues object has the following table:

    [0]
         Foodcatagory = "Grains"
         FoodCatagory_ID = 1
    
    [1]
         Foodcatagory = "Vegetables"
         FoodCatagory_ID = 2
    
    
    
    
    etc. all the way up to index 5
    
    
    

    How can I get the drop-down list to display only the Grains, vegetables... etc.?

    Thank you

    I had to search around for a few hours today on the same subject.

    Basically just set the labelField of the drop-down list the name of the field for its values

    foodCategory.FoodCategory_DropDown.labelField = "Foodcatagory";
    
  • Adobe LiveCycle upper tiny typed value in a drop-down list

    Please let me know if there is a way for a user (someone sent a form created with Adobe LiveCycle Designer to complete and send back) to be able to click on a menu drop down populated list and type a value that corresponds to one of the values in the drop-down list, but for the user do not have to worry about whether or not they type using all capital letters lowercase, or a mixture.

    For example, my XML data for this list is a list of over 1200 names as follows:

    < text > Jim Nazium < / text >

    Chuck Roast < text > < / text >

    < text > George Towne < / text >

    etc...

    I would like the user to be able to type "Geo" or "GEO" or "geo" and taking the part of the drop-down list for the first George, it is a...

    Thank you

    I used to do this workaround was to make the data all uppercase and then forcing user uppercase input.

    To force the capital letters, you can use the following on the change event:

    XFA. Event.change = xfa.event.change.toUpperCase ();

Maybe you are looking for