Hi everyone.
Help with this problem.
With Google I found this script:
I change this way:
Have a variable ( associated with the selected value from select Choose a Region ), which can be A or B.
I select the value Presente ( variable A ) from select Choose a Region :
1) When the variable is A, in select Choose a City is:
I select the value Presente ( variable B ) from select Choose a Region :
2) When the variable is B in select Choose a City is:
Is possible?
Regards,
Viki
Help with this problem.
With Google I found this script:
Code:
var regiondb = new Object()
regiondb["Assente"] = [{value:"Ferie", text:"Ferie"},
{value:"Festività abolita", text:"Festività abolita"},
{value:"Malattia", text:"Malattia"},
{value:"Infortunio", text:"Infortunio"},
{value:"Riposo Fisiologico", text:"Riposo Fisiologico"},
{value:"Riposo Compensativo", text:"Riposo"},
{value:"Permesso retribuito", text:"Permesso"},
{value:"Permesso Sind./ARCA", text:"Permesso Sind."},
{value:"Ricovero Ospedaliero", text:"Ricovero"},
{value:"Part-time", text:"Part-time"},
{value:"Assemblea Sindacale", text:"Assemblea"},
{value:"Sciopero", text:"Sciopero"},
{value:"Aspettativa", text:"Aspettativa"},
{value:"Carica Pubblica", text:"Carica Pubblica"},
{value:"Da giustificare", text:"Da giustificare"}];
regiondb["Presente"] = [{value:"Monoperatore", text:"Monoperatore"},
{value:"Coppia", text:"Coppia"},
{value:"Formazione a tre", text:"Formazione a tre"},
{value:"Appoggio", text:"Appoggio"},
{value:"Fuori sede", text:"Fuori sede"},
{value:"In sede", text:"In sede"}];
function setCities(chooser) {
var newElem;
var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
var cityChooser = chooser.form.elements["tipo_stato_giornaliero"];
while (cityChooser.options.length) {
cityChooser.remove(0);
}
var choice = chooser.options[chooser.selectedIndex].value;
var db = regiondb[choice];
newElem = document.createElement("option");
newElem.text = "Seleziona valore";
newElem.value = "";
cityChooser.add(newElem, where);
if (choice != "") {
for (var i = 0; i < db.length; i++) {
newElem = document.createElement("option");
newElem.text = db[ i ].text;
newElem.value = db[ i ].value;
cityChooser.add(newElem, where);
}
}
Have a variable ( associated with the selected value from select Choose a Region ), which can be A or B.
I select the value Presente ( variable A ) from select Choose a Region :
1) When the variable is A, in select Choose a City is:
Code:
<option value="Fuori Sede">Fuori Sede</option> <option value="In Sede">In Sede</option>
2) When the variable is B in select Choose a City is:
Code:
<option value="Coppia">Coppia</option> <option value="Formazione a tre">Formazione a tre</option> <option value="Appoggio">Appoggio</option> <option value="Fuori Sede">Fuori Sede</option> <option value="In Sede">In Sede</option>
Regards,
Viki
Comment