468,525 Members | 2,200 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,525 developers. It's quick & easy.

Please help : Add value to dropdownlist using the javascript

I have the dropdownlist that is populated when the form is loaded.
I have the button that opens search child window using the
modalwindowdialog and it returns the value that I want to add to the
dropdownlist on the parent window using the javascript as there will
not be any event fired when the childwindow is closed.

function GetMeds()
{
var MedsString = window.showModalDialog("SearchColor.aspx", window,
"dialogHeight: 700px; dialogWidth: 700px; edge: Raised; center: No;
help: Yes; resizable: Yes; status: Yes;");

if(MedsString)
{

var ddvalue = MedsString.substring(0,MedsString.indexOf('~'));
var ddtext = MedsString.substring(MedsString.indexOf('~~')+2);
return false;

}

}

I want to add the above ddvalue and the ddtext to the dropdownlist
ddlColor on the aspx page.

Any suggestions will be helpful.

Thanks,

Jul 23 '05 #1
1 2165
ri******@yahoo.com wrote:
I have the dropdownlist that is populated when the form is loaded.
I have the button that opens search child window using the
modalwindowdialog and it returns the value that I want to add to the
dropdownlist on the parent window using the javascript as there will
not be any event fired when the childwindow is closed.

function GetMeds()
{
var MedsString = window.showModalDialog("SearchColor.aspx", window,
"dialogHeight: 700px; dialogWidth: 700px; edge: Raised; center: No;
help: Yes; resizable: Yes; status: Yes;");

showModalDialog is IE-only, can you implement a more standards-based
approach?
if(MedsString)
{

var ddvalue = MedsString.substring(0,MedsString.indexOf('~'));
var ddtext = MedsString.substring(MedsString.indexOf('~~')+2);
return false;

}

}

I want to add the above ddvalue and the ddtext to the dropdownlist
ddlColor on the aspx page.


Have a read of Richard Cornford's instructions for adding options in
IE:

<URL:http://groups-beta.google.com/group/comp.lang.javascript/browse_frm/thread/af6e808b089f60f8/0a5222cd15fc5e11?q=add+option+select+drop+down+IE& rnum=3&hl=en#0a5222cd15fc5e11>
--
Rob
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Stephen | last post: by
2 posts views Thread by Benedict Teoh | last post: by
reply views Thread by ritskits | last post: by
3 posts views Thread by Robert Dufour | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.