Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / March 2007



Tip: Looking for answers? Try searching our database.

Setting options on a select box (ComboBox) - in another window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jodleren - 30 Mar 2007 15:48 GMT
Hi!

I use this to read on the value of my "parent" window.

stemp=window.opener.document.forms[0].workgroup.value;

Works well.

Say, I'd like to add an items to that, and select it?

stemp=window.opener.document.forms[0].workgroup.options[0].value="hello
world";
- does not work.

Any ideas?
Marc - 30 Mar 2007 19:40 GMT
> Hi!
>
[quoted text clipped - 11 lines]
>
> Any ideas?

How about:

addOptions(window.opener.document.forms[0].workgroup, 0, "hello");
/* oValue can also be a string */
function addOptions(object, oValue, oText) {
   var defaultSelected = true; var selected = true;
   var optionName = new Option(oText, oValue, defaultSelected, selected)
   var length = object.length;
   object.options[length] = optionName;
}
jodleren - 31 Mar 2007 13:42 GMT
> > Hi!
>
[quoted text clipped - 21 lines]
>     var length = object.length;
>     object.options[length] = optionName;

> }

I tried something like that, but never got it to work.

I might take a look at that later, but I had another problem here -
that when reloading the page (location.reload og history.go(0)) it
asked whether to repost data.

Therefore I came up this:
a hidden value on the form, which can be set from the popup window.
Then I submit it. Like this:

window.opener.document.forms[0].reload.value="yes";
window.opener.document.forms[0].submit();

Then I check the $_post[reload] when submitted :-)

I think of it as a nice solution. It will the reload the combobox, and
avoid the forms main submit functionality.

BR
Sonnich
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.