Toutes mes réponses sur les forums
-
AuteurRéponses
-
Justy
Participantmerci pour ta réponse
cela devrait orienter mes choix futurs
Justy
Participantj’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.”);
}Justy
Participantj’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.”);
}Justy
Participantje te remercie
j’ai remarquer à posteriori le fichier jointj’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 )
Justy
Participantmerci 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 -
AuteurRéponses