Hi, i'm trying to make a form like this below
http://www.screencast.com/t/soblyCjmVK1
DB Table - SEDE_INSTALLAZIONE
ID_SEDE
DESCRIZIONE
DB Table - ANAG_VIDEO
ID_VIDEO
DESCRIZIONE
DB Table - SEDE_INSTALLAZIONE_VIDEO -> Correlation between the two tables
ID_SEDE
ID_VIDEO
the form should be work in this mode
Select sede_installazione
Listbox "Video Associati" -> populing with all videos already associated
Listbox "Video Non Associati" -> populing with all videos available except that already associated
the buttons ADD and REMOVE have to move video from side to other side
and in the end will be button SUBMIT that save data in DB in SEDE_INSTALLAZIONE_VIDEO deleting all record for ID_SEDE and inserting new record from associated listbox
----
in this moment i made ( and works ) only first 2 points
(Select sede_installazione
Listbox "Video Associati" -> populing with all videos already associated )
but i have some problems to populing "video non associati" because i want put all video that i have in table ANAG_VIDEO ( and i can do it ), but i want don't show videos already present in "video associati"
i'm trying in event ajax2 to put the custom code after dbread
but don't work, maybe 'VideoSedeDescr' is not available ?
OR
is possible make a where condition in dbread like this ?
WHERE ANAG_VIDEO.ID_VIDEO NOT IN ( SELECT ID_VIDEO FROM sede_installazione_video WHERE ID_SEDE = 1 )
http://www.screencast.com/t/soblyCjmVK1
DB Table - SEDE_INSTALLAZIONE
ID_SEDE
DESCRIZIONE
DB Table - ANAG_VIDEO
ID_VIDEO
DESCRIZIONE
DB Table - SEDE_INSTALLAZIONE_VIDEO -> Correlation between the two tables
ID_SEDE
ID_VIDEO
the form should be work in this mode
Select sede_installazione
Listbox "Video Associati" -> populing with all videos already associated
Listbox "Video Non Associati" -> populing with all videos available except that already associated
the buttons ADD and REMOVE have to move video from side to other side
and in the end will be button SUBMIT that save data in DB in SEDE_INSTALLAZIONE_VIDEO deleting all record for ID_SEDE and inserting new record from associated listbox
----
in this moment i made ( and works ) only first 2 points
(Select sede_installazione
Listbox "Video Associati" -> populing with all videos already associated )
but i have some problems to populing "video non associati" because i want put all video that i have in table ANAG_VIDEO ( and i can do it ), but i want don't show videos already present in "video associati"
i'm trying in event ajax2 to put the custom code after dbread
<?php
$options = array();
if ( !$form->data['AnagVideo'] || count($form->data['AnagVideo']) < 1 ) {
// no result was found
$options[] = 'Seleziona Sede/Nessun video da associato';
} else {
foreach ( $form->data['AnagVideo'] as $d ) {
$trovato = 'no';
foreach ( $form->data['VideoSedeDescr'] as $v ) {
if ( $d[ID_VIDEO'] == $v['ID_VIDEO'] ) {
$trovato = 'si';
}
}
if ( $trovato == 'no' ) {
$options[$d['ID_VIDEO']] = $d['DESCRIZIONE'];
}
}
}
echo json_encode($options);
?>
but don't work, maybe 'VideoSedeDescr' is not available ?
OR
is possible make a where condition in dbread like this ?
WHERE ANAG_VIDEO.ID_VIDEO NOT IN ( SELECT ID_VIDEO FROM sede_installazione_video WHERE ID_SEDE = 1 )