I have two dropdowns - one is a list which then, using javascript, populates the other with a name/email address. stored in the js file. Is there a way of populating the second dropdown with nodes/properties from my umbraco installation - thus giving the client the abilitiy to change the content of the drop via the CMS?
There's some similar topics on the forum here but I'm not sure these do what I need - so apologies if I'm duplicating anything.
Thanks
Darren
Here's the JS:
team = new Array( null, new Array( new Array("Darren Wilson"), new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com") ), new Array( new Array("Darren Wilson"), new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com") ), new Array( new Array("Darren Wilson"), new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com") ), null, new Array( new Array("Darren Wilson"), new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com") ), new Array( new Array("Darren Wilson"), new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com") ), new Array( new Array("Darren Wilson"), new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com") ), new Array( new Array("Darren Wilson"), new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com") ), null, new Array( new Array("Darren Wilson"), new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com") ), null, new Array( new Array("Darren Wilson"), new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com") ) ); function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) { var i, j; var prompt; // empty existing items for (i = selectCtrl.options.length; i >= 0; i--) { selectCtrl.options[i] = null; } prompt = (itemArray != null) ? goodPrompt : badPrompt; if (prompt == null) { j = 0; } else { selectCtrl.options[0] = new Option(prompt); j = 1; } if (itemArray != null) { // add new items for (i = 0; i < itemArray.length; i++) { selectCtrl.options[j] = new Option(itemArray[i][0]); if (itemArray[i][1] != null) { selectCtrl.options[j].value = itemArray[i][1]; } j++; } // select first item (prompt) for sub list selectCtrl.options[0].selected = true; } } function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; }
Dynamic populate javascript drop-down
Hi Folks,
I have two dropdowns - one is a list which then, using javascript, populates the other with a name/email address. stored in the js file. Is there a way of populating the second dropdown with nodes/properties from my umbraco installation - thus giving the client the abilitiy to change the content of the drop via the CMS?
There's some similar topics on the forum here but I'm not sure these do what I need - so apologies if I'm duplicating anything.
Thanks
Darren
Here's the JS:
team = new Array(
null,
new Array(
new Array("Darren Wilson"),
new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com")
),
new Array(
new Array("Darren Wilson"),
new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com")
),
new Array(
new Array("Darren Wilson"),
new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com")
),
null,
new Array(
new Array("Darren Wilson"),
new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com")
),
new Array(
new Array("Darren Wilson"),
new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com")
),
new Array(
new Array("Darren Wilson"),
new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com")
),
new Array(
new Array("Darren Wilson"),
new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com")
),
null,
new Array(
new Array("Darren Wilson"),
new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com")
),
null,
new Array(
new Array("Darren Wilson"),
new Array("darren.wilson@shaw-online.com", "mailto:darren.wilson@shaw-online.com")
)
);
function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
var i, j;
var prompt;
// empty existing items
for (i = selectCtrl.options.length; i >= 0; i--) {
selectCtrl.options[i] = null;
}
prompt = (itemArray != null) ? goodPrompt : badPrompt;
if (prompt == null) {
j = 0;
}
else {
selectCtrl.options[0] = new Option(prompt);
j = 1;
}
if (itemArray != null) {
// add new items
for (i = 0; i < itemArray.length; i++) {
selectCtrl.options[j] = new Option(itemArray[i][0]);
if (itemArray[i][1] != null) {
selectCtrl.options[j].value = itemArray[i][1];
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;
}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.