PDA

View Full Version : dhtml.dropdown / Queries



saintsservers
11-06-2008, 01:14 PM
I'm looking to run some DekiScript on a selected value from a dropdown. Eventually, I want to list some content based off of the value, but for the moment I'm trying to merely display the selected value. What is wrong with the below?

I don't quite understand the concept of publishing/channels:



foreach(var p in wiki.getsearch('tag:Company', '500', _, ''))
{
let dropdown ..= [ p.title ];
}
var dropdown = list.sort(dropdown, '');
dhtml.dropdown(dropdown,[ ], "company");

dhtml.span("company","");


Regards,
Lewis

SteveB
11-12-2008, 02:34 PM
Try this:


foreach(var p in wiki.getsearch('tag:Company', '500', _, ''))
{
let dropdown ..= [ { title: p.title } ];
}
var dropdown = list.sort(dropdown, 'title');
dhtml.dropdown(dropdown, dropdown, @company);

dhtml.span("company","title", @company);

The second parameter in dhtml.dropdown is the "message" (or data-structure) that is published on the javascript channel. If it's empty, you won't receive anything. The second parameter in the dthml.span function is the name of the field to use when a message is received. Hope that helps!