473,386 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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?

Mar 30 '07 #1
2 3990
"jodleren" <so*****@hot.eewrote in message
news:11**********************@d57g2000hsg.googlegr oups.com...
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?
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;
}
Mar 30 '07 #2
On Mar 30, 9:40 pm, "Marc" <sorry...@dirtymail.comwrote:
"jodleren" <sonn...@hot.eewrote in message

news:11**********************@d57g2000hsg.googlegr oups.com...


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?

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;
}
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

Mar 31 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
3
by: Max Weber | last post by:
Try to run the code below in a page. You will notice than when you switch the multiple attribute of the SELECT tag, only one option is displayed as selected although multiple options have ben...
9
by: netclectic | last post by:
I'm dynamically adding options to a select list in javascript and i need to be able to set the height of the option, but setting style.height has not effect, I also tried style.pixelHeight but no...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
5
by: GTi | last post by:
Whats wring with this code? <select class=EditField size="1" name="PlantUnitID" title="Select line"> <option value="0" >Standalone Unit</option> <option value="1" selected >Connected Unit...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
4
by: teknoshock | last post by:
I have created a page with multiple drop down boxes, all populated with the same options. My problem is, for 12 dropdown boxes and 40 choices per box, I end up with a massive file. Also, if I...
1
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just...
1
by: Thelma Roslyn Lubkin | last post by:
I have a form with several comboboxes whose contents I'm trying to initialize from a table. The table, ComboSelections, has 3 fields, an autonumber ID and two text fields, ListCode and ListEntry....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.