Please help : Add value to dropdownlist using the javascript

R

ritskits

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,
 
R

RobG

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...ct+drop+down+IE&rnum=3&hl=en#0a5222cd15fc5e11>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top