J'ai fait a peu près la même chose sur le truc avec lequel je bosse en ce moment.
J'ai fait ça avec javascript je te donne le code des fonction qui permettent de faire ça :
Le formulaire s'appelle RetourFiche et le select où apparaissent les données de la BD s'apel Liste_Form
ensuite il te faut créer deux boutons avec comme onClick="javascript:droite()" pour faire passer de la gauche vers la droite et l'inverse pour l'autre bouton.
function droite()
{
var select1=document.RetourFiche.Liste_Form;
var select2=document.RetourFiche.Candidat_Form;
var select3=document.RetourFiche.choixF;
var index, trouve=false;
for(i=0;i<select2.length && !trouve;i++)
{
if (select2.options[i].value==select1.options[select1.selectedIndex].value)
{
select1.options[select1.selectedIndex].value=null;
trouve=true;
}
}
if (!trouve)
{
index=select2.options.length;
select2.options[index]=new Option(select1.options[select1.selectedIndex].text,select1.options[select1.selectedIndex].value);
if (select3.value!='')
{
select3.value=select3.value + ';';
}
select3.value=select3.value + select1.options[select1.selectedIndex].value;
select1.options[select1.options.selectedIndex]=null;
}
}
function gauche()
{
var select1=document.RetourFiche.Candidat_Form;
var select2=document.RetourFiche.Liste_Form;
var select3=document.RetourFiche.choixF;
var index;
for(i=0; i<select1.options.length; i++)
{
if (select1.options[i].selected)
{
index=select2.options.length;
select2.options[index]=new Option(select1.options[select1.selectedIndex].text,select1.options[select1.selectedIndex].value);
SupMot(select3,select1.options[i],select3);
select1.options[i]=null;
i--;
}
}
}
function SupMot(objSelect,objOption,objHidden)
{
var i=0; champ1=objHidden.value,mot=objOption.value,champ2='';
i = champ1.indexOf(mot);
while (i!=-1 && i<champ1.length)
{
if ((i==0 || champ1.charAt(i-1)==';') && ((i+mot.length)==champ1.length || champ1.charAt(i+mot.length)==';'))
{
// si partie avant occurence, on supprime le ';'
if (i>1)
{
champ2=champ1.substring(0,i-1);
}
// si partie après l'occurence
if ((i+mot.length)<champ1.length);
{
// si 1er mot on supprime le ';' après le mot
if (i==0)
{
champ2 = champ2 + champ1.substring(i + mot.length + 1,champ1.length);
} else {
// sinon on conserve le séparateur, celui avant le mot étant déjà supprimé
champ2 = champ2 + champ1.substring(i + mot.length, champ1.length);
}
}
objHidden.value=champ2;
}
i=champ1.indexOf(mot,i+1);
}
}
Voilà j'espere que j'ai été assez clair et que ton problème est résolu!
