nkrgupta
12-07-2005, 11:29 AM
Hi,
I have a select box which has a "Create category" option. When this option is selected, a popup appears where the user can enter a name and a category by that name is created on clicking the submit button. what i want though is that the newly created category name be sent back as an additional <option> to the parent select box (in the previous page), apart from all the server side operations, which are running smoothly now. I got this following piece of code which is doing exactly what i require, but only in FireFox. I want it to work in IE as well, but the select box is not being populated...
Any clues....?
This is the JS function within the <body> tag of the popup --
<script language="JavaScript">
function add(option,oSelect)
{
var n = document.createElement('option');
n.innerHTML = option;
n.setAttribute('value',option);
oSelect.appendChild(n);
}
add('$name',window.opener.document.forms[0].elements['cat_sel']);
</script>
The whole thing is a CGI affair.. In the above code, $name is the name of the category which i'm getting from my cgi and 'cat_sel' is the name of the <select> box in the parent page.
Thanks
Naveen
I have a select box which has a "Create category" option. When this option is selected, a popup appears where the user can enter a name and a category by that name is created on clicking the submit button. what i want though is that the newly created category name be sent back as an additional <option> to the parent select box (in the previous page), apart from all the server side operations, which are running smoothly now. I got this following piece of code which is doing exactly what i require, but only in FireFox. I want it to work in IE as well, but the select box is not being populated...
Any clues....?
This is the JS function within the <body> tag of the popup --
<script language="JavaScript">
function add(option,oSelect)
{
var n = document.createElement('option');
n.innerHTML = option;
n.setAttribute('value',option);
oSelect.appendChild(n);
}
add('$name',window.opener.document.forms[0].elements['cat_sel']);
</script>
The whole thing is a CGI affair.. In the above code, $name is the name of the category which i'm getting from my cgi and 'cat_sel' is the name of the <select> box in the parent page.
Thanks
Naveen