Originariamente inviato da Luca_2030
avevo pensato + o meno la stessa cosa, li potrei mettere nella selct ma dovrei renderli "invisibili" semmai.. è possibile ?
Quale è il collegamento tra i dati della select e quelli che vuoi mettere negli input ?
ad esempio se nella select hai :
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function popola(indice) {
//------ Azzero i campi
document.getElementById('primo').value = '';
document.getElementById('secondo').value = '';
//------ Indice 0 -> Esco
if (indice == 0) {
return;
} // if (indice == 0)
//------ Compongo gli id delle variabili hidden
a = "valore"+indice+"1";
b = "valore"+indice+"2";
//------ Assegno i valori
document.getElementById('primo').value = document.getElementById(a).value;
document.getElementById('secondo').value = document.getElementById(b).value;
} // function popola(indice)
//-->
</script>
</head>
<body>
<select id="pippo" onchange="popola(this.selectedIndex)">
<option value="" >Seleziona un valore</option>
<option value="1000">1000</option>
<option value="1001">1001</option>
<option value="1002">1002</option>
<option value="1003">1003</option>
<option value="1004">1004</option>
</select>
Primo valore :
<input type="text" size="50" id="primo">
Secondo valore :
<input type="text" size="50" id="secondo">
<input type="hidden" id="valore11" value="primo valore legato a 1000">
<input type="hidden" id="valore12" value="secondo valore legato a 1000">
<input type="hidden" id="valore21" value="primo valore legato a 1001">
<input type="hidden" id="valore22" value="secondo valore legato a 1001">
<input type="hidden" id="valore31" value="primo valore legato a 1002">
<input type="hidden" id="valore32" value="secondo valore legato a 1002">
<input type="hidden" id="valore41" value="primo valore legato a 1003">
<input type="hidden" id="valore42" value="secondo valore legato a 1003">
<input type="hidden" id="valore51" value="primo valore legato a 1004">
<input type="hidden" id="valore52" value="secondo valore legato a 1004">
</body>
</html>
Ti basta fare un ciclo sui dati correlati a creare delle variabili "hidden"