Here is some javascript to use to get this working on the web:
function changed(el, cmp, pmt){
if(el.options[el.selectedIndex].value==cmp) {addoption(el, pmt);}
}
function addoption(el, pmt){
var txt=prompt(pmt,'');
if(txt==null) {return;}
var o=new Option( txt, txt, false, true);
el.options[el.options.length]=o;
}
You can either put this in an included javascript file or wrap it directly inline.
Then you can call it using the onchange event for your selection field:
onchange="changed(this, 'New Group', 'Please enter new group:')"
Where "New Group" is the text you want to trigger the prompt for the text and "Please enter new group" is the prompt you want to display.
No comments:
Post a Comment