Donnez vie à vos documents numériques !
 

Liste MEre Fille – que faire du bout de code ?

abracadabraPDF Forums PDF – Général Liste MEre Fille – que faire du bout de code ?

  • Ce sujet est vide.
  • Créateur
    Sujet
  • #46630
    Justy
    Participant

    bonjour,sur ce sujet
    j’ai trouvé ce bout de code/exemple qui correspond à ce que je souhaite ( Liste Mere Fille ) – je n’ai pas de 3eme niveau
    comment puis je le déporter sur mon tableau partiel ( en PJ )il faudras dupliquer celui ci sur les 12 lignes de mon tableau

    merci

Affichage de 9 réponses de 1 à 9 (sur un total de 9)
  • Auteur
    Réponses
  • #69417
    Merlin
    Maître des clés

    Bonjour

    L’exemple ( http://practicalpdf.com/acrobat-javascript-examples/dependentLists.pdf ) fourni sur la page que tu cites me parait simple à adapter, il te suffit de copier-coller les deux listes déroulantes et d’adapter le script, qui se trouve dans le champ “masterDropdown”.

    Pour la duplication c’est à peine plus compliqué, il faut dans le script adapter le nom du champ cible (dependentDropdown.1, dependentDropdown.2, dependentDropdown.3, etc).

    #69418
    Justy
    Participant

    merci pour ta réponse
    pour l’histoire du code à copier/coller/adapter, OKmais ou  dois je rentrer les listes ?quelque part ou les choix sont contenu dans le bout de code

    #69419
    bebarth
    Maître des clés

    bonjour,
    Juste quelques lignes à modifier :

    Code:
    */
    var dependentListBoxFieldName = “ListeFille”;
    var dependentListValues =
    {
        “C”: [
            [“C1”, “export C1”],
            [“C2”, “export C2”],
            [“C3”, “export C3”]
        ],
        “B”: [
            [“B1”, “export B1”],
            [“B2”, “export B2”],
            [“B3”, “export B3”]
        ],
        “M”: [
            [“M1”, “export M1”],
            [“M2”, “export M2”],
            [“M3”, “export M3”]
        ],
        “L”: [
            [“L1”, “export L1”],
            [“L2”, “export L2”],
            [“L3”, “export L3”]
        ]
    };
    /*

    @+
    :bonjour:

    #69420
    Justy
    Participant

    je te remercie
    j’ai remarquer à posteriori le fichier joint

    j’aurais une petite faveur

    dans le menu mère,
    peux tu me rajouter C – B – M1 – M2 – L ( soit un 4éme choix possible au lieu de 3 )

    pour la liste fille,tu as mis 3 choix possible { X1 – X2 et X3},peux tu mettre 9 choix possible pour chaque ( mon choix max étant de 9 pour M1 )

    #69421
    bebarth
    Maître des clés

    bonjour,
    Désolé je suis en congés juste avec mon téléphone jusqu’au 1 septembre…
    Mais avec le code fourni je pense que ce n’est pas très difficile à comprendre !
    @+
    :bonjour:

    #69422
    Justy
    Participant

    j’ai ajouter les choix dans le code de la Liste Mere
    mais celui ci refuse de la valider, il bloque à la ligne “
    [“Bu”, “export Lo1”],

    j’ai du faire une erreur dans le format à fournir

    Code:
    /*
    LICENSE:
    acrojs_dependentList.js by Joel Geraci is licensed under a Creative Commons Attribution 4.0 International License.
    https://creativecommons.org/licenses/by/4.0/

    You are free to:
    Share — copy and redistribute the material in any medium or format
    Adapt — remix, transform, and build upon the material for any purpose, even commercially.

    Setup:
    For list boxes:  Add this script to the “selection change” script of the master list box.
    For combo boxes: Add this script to the “custom format” script of the dropdown box.

    IMPORTANT!
    Edit the following line to identify the field name of the dependent list box then edit the properties of the dependentListValues JSON object. Property names should correspond to the export values of the list items.
    */
    var dependentListBoxFieldName = “ListeFille”;
    var dependentListValues =
    {
    “Clés”: [
    [“PG”, “export C1”],
    [“PP”, “export C2”],
    [“CBI”, “export C3”]
    [“PAC”, “export C4”]
    [“A(à préciser)”, “export C5”]
    ],
    “Badges”: [
    [“CA”, “export B1”],
    [“Ca”, “export B2”],
    [“Co”, “export B3”]
    [“A(àpréciser)”, “export B4”]
    ],
    “Matériels”: [
    [“Tel”, “export Ma1”],
    [“Ord”, “export Ma2”],
    [“Ta”, “export Ma3”]
    [“Im”, “export Ma4”]
    [“EV”, “export Ma5”]
    [“VP”, “export Ma6”]
    [“RS”, “export Ma7”]
    [“C(à préciser)”, “export Ma8”]
    [“Autre (àpréciser)”, “export Ma9”]
    ],
    “Mobiliers”: [
    [“Ves”, “export Mo1”],
    [“Bu/Ta”, “export Mo2”],
    [“AH”, “export Mo3”]
    [“AB”, “export Mo4”]
    [“A(à préciser)”, “export Mo5”]
    [“A( à préciser)”, “export Mo6”]
    ]
    “Locaux”: [
    [“Bu”, “export Lo1”],
    [“Ves”, “export Lo2”],
    [“Re/St”, “export Lo3”]
    [“Ac/De”, “export Lo4”]
    [“A( à préciser)”, “export Lo5”]
    ]
    };
    /*
    You probably don’t need to change anything from here down
    */
    if ((event.target.type == “combobox” && event.name == “Format”) || (event.target.type == “listbox” && event.name == “Keystroke”)) {
    if (event.target.type == “combobox”) {
    if (dependentListValues.hasOwnProperty(event.target.value)) {
    this.getField(dependentListBoxFieldName).setItems(dependentListValues[event.target.value]);
    }
    else {
    this.getField(dependentListBoxFieldName).clearItems();
    }
    }
    if (event.target.type == “listbox” && dependentListValues.hasOwnProperty(event.changeEx)) {
    this.getField(dependentListBoxFieldName).setItems(dependentListValues[event.changeEx]);
    }
    }
    else {
    app.alert(“This script was not intended for this field type or event.”);
    }

    #69423
    bebarth
    Maître des clés

    Il manque une virgule après chaque élément (normalement sauf le dernier mais si ce n’est pas grave si tu en mets une).

    [“Ta”, “export Ma3”],

    @+
    :bonjour:

    #69424
    Justy
    Participant

    j’ai ajouter les virgulesmais ils continue de bloquer sur la même ligne

    Code:
            [“Bu”, “export Lo1”],
    Code:

    /*
    LICENSE:
    acrojs_dependentList.js by Joel Geraci is licensed under a Creative Commons Attribution 4.0 International License.
    https://creativecommons.org/licenses/by/4.0/

    You are free to:
    Share — copy and redistribute the material in any medium or format
    Adapt — remix, transform, and build upon the material for any purpose, even commercially.

    Setup:
    For list boxes:  Add this script to the “selection change” script of the master list box.
    For combo boxes: Add this script to the “custom format” script of the dropdown box.

    IMPORTANT!
    Edit the following line to identify the field name of the dependent list box then edit the properties of the dependentListValues JSON object. Property names should correspond to the export values of the list items.
    */
    var dependentListBoxFieldName = “ListeFille”;
    var dependentListValues =
    {
        “Clés”: [
            [“PG”, “export C1”],
            [“PP”, “export C2”],
            [“CBI”, “export C3”],
            [“PAC”, “export C4”],
            [“A(à préciser)”, “export C5”],
        ],
        “Badges”: [
            [“CA”, “export B1”],
            [“Ca”, “export B2”],
            [“Co”, “export B3”],
            [“A(àpréciser)”, “export B4”],
        ],
        “Matériels”: [
            [“Tel”, “export Ma1”],
            [“Ord”, “export Ma2”],
            [“Ta”, “export Ma3”],
            [“Im”, “export Ma4”],
            [“EV”, “export Ma5”],
            [“VP”, “export Ma6”],
            [“RS”, “export Ma7”],
            [“C(à préciser)”, “export Ma8”],
            [“Autre (àpréciser)”, “export Ma9”],
        ],
        “Mobiliers”: [
            [“Ves”, “export Mo1”],
            [“Bu/Ta”, “export Mo2”],
            [“AH”, “export Mo3”],
            [“AB”, “export Mo4”],
            [“A(à préciser)”, “export Mo5”],
            [“A( à préciser)”, “export Mo6”],
        ]
        “Locaux”: [
            [“Bu”, “export Lo1”],
            [“Ves”, “export Lo2”],
            [“Re/St”, “export Lo3”],
            [“Ac/De”, “export Lo4”],
            [“A( à préciser)”, “export Lo5”],
        ]
    };
    /*
    You probably don’t need to change anything from here down
    */
    if ((event.target.type == “combobox” && event.name == “Format”) || (event.target.type == “listbox” && event.name == “Keystroke”)) {
        if (event.target.type == “combobox”) {
            if (dependentListValues.hasOwnProperty(event.target.value)) {
                this.getField(dependentListBoxFieldName).setItems(dependentListValues[event.target.value]);
            }
            else {
                this.getField(dependentListBoxFieldName).clearItems();
            }
        }
        if (event.target.type == “listbox” && dependentListValues.hasOwnProperty(event.changeEx)) {
            this.getField(dependentListBoxFieldName).setItems(dependentListValues[event.changeEx]);   
        }
    }
    else {
        app.alert(“This script was not intended for this field type or event.”);   
    }

    #69425
    Merlin
    Maître des clés

    Une virgule vous manque et rien ne va plus  :geek:

    var dependentListBoxFieldName = “ListeFille”;
    var dependentListValues =
    {
        “Clés”: [
            [“PG”, “export C1”],
            [“PP”, “export C2”],
            [“CBI”, “export C3”],
            [“PAC”, “export C4”],
            [“A(à préciser)”, “export C5”],
        ],
        “Badges”: [
            [“CA”, “export B1”],
            [“Ca”, “export B2”],
            [“Co”, “export B3”],
            [“A(àpréciser)”, “export B4”],
        ],
        “Matériels”: [
            [“Tel”, “export Ma1”],
            [“Ord”, “export Ma2”],
            [“Ta”, “export Ma3”],
            [“Im”, “export Ma4”],
            [“EV”, “export Ma5”],
            [“VP”, “export Ma6”],
            [“RS”, “export Ma7”],
            [“C(à préciser)”, “export Ma8”],
            [“Autre (àpréciser)”, “export Ma9”],
        ],
        “Mobiliers”: [
            [“Ves”, “export Mo1”],
            [“Bu/Ta”, “export Mo2”],
            [“AH”, “export Mo3”],
            [“AB”, “export Mo4”],
            [“A(à préciser)”, “export Mo5”],
            [“A( à préciser)”, “export Mo6”],
        ], //
        “Locaux”: [
            [“Bu”, “export Lo1”],
            [“Ves”, “export Lo2”],
            [“Re/St”, “export Lo3”],
            [“Ac/De”, “export Lo4”],
            [“A( à préciser)”, “export Lo5”],
        ]
    };
    /*
    You probably don’t need to change anything from here down
    */
    if ((event.target.type == “combobox” && event.name == “Format”) || (event.target.type == “listbox” && event.name == “Keystroke”)) {
        if (event.target.type == “combobox”) {
            if (dependentListValues.hasOwnProperty(event.target.value)) {
                this.getField(dependentListBoxFieldName).setItems(dependentListValues[event.target.value]);
            }
            else {
                this.getField(dependentListBoxFieldName).clearItems();
            }
        }
        if (event.target.type == “listbox” && dependentListValues.hasOwnProperty(event.changeEx)) {
            this.getField(dependentListBoxFieldName).setItems(dependentListValues[event.changeEx]); 
        }
    }
    else {
        app.alert(“This script was not intended for this field type or event.”); 
    }

Affichage de 9 réponses de 1 à 9 (sur un total de 9)
  • Vous devez être connecté pour répondre à ce sujet.