Plugin Developer Discussion

Discussion for FogBugz Plugin developers

How to define an event for a SelectInput dialogItem

Hi,

While developing a plugin for adding some customer information to a case, I was looking for the possibility to add an event to a SelectInput dialogItem:

CBugDisplayDialogItem ddlCustomer = new CBugDisplayDialogItem("Customer");
            ddlCustomer.sLabel = FIELD_DISPLAY_NAME;
            ddlCustomer.sContent = Forms.SelectInput(api.PluginPrefix, customers.ToArray());

CBugDisplayDialogItem ddlCorrespondent = new CBugDisplayDialogItem("Correspondent");           
            ddlCorrespondent.sLabel = "Correspondent";
            ddlCorrespondent.sContent = Forms.SelectInput(api.PluginPrefix + "correspondent", customers.ToArray());

What I want:
If the SelectInput Customer is changed, load the other one with the persons who work at the selected company. Data is coming from two different tables in the fogbugz database.

Can you please inform me how to add an event for this?

Thanks in advance.
Joris van der Straten Send private email
Tuesday, September 8, 2009
 
 
It sounds like you want to add a JavaScript "onchange" event.  You could do this using the following:

Hashtable attributes = new Hashtable();
attributes["onclick"] = "myFunction();"

ddlCorrespondent.sContent = Forms.SelectInput(api.PluginPrefix + "correspondent", customers.ToArray(), null, null, attributes);
David Fullerton Send private email
Tuesday, September 8, 2009
 
 
Thank you for your quick reply David!
Problem now is, how can I load any new data into the second dropdownlist? Is it possible to do this in the same plugin? Or do I have to do this in a second plugin which is used for sending back the values via javascript?
Joris van der Straten Send private email
Wednesday, September 9, 2009
 
 
You can use AJAX to retrieve values from the raw page (IPluginRawPageDisplay) of your plugin.  See this wiki page for an example:

https://developers.fogbugz.com/default.asp?W60

In your case you could just return the entire <select> box and insert it into the page. If you encounter a problem where the <select> box is invisible, just call

api.DropListControl.refresh(select);

where "select" is a reference to the <select> node in the DOM.  This will tell our special droplist code to refresh the display of that select box.
David Fullerton Send private email
Thursday, September 10, 2009
 
 
David, thanks for your answer, but can you please explain it a bit more?

Where do I put the javascript for calling the IPluginRawPageDisplay part of the plugin for getting the second dropdownlist? In the BugDisplayEditLeft method of the IPluginBugDisplay?

Also, api.DropListControl is not available.

Thanks in advance.
Joris van der Straten Send private email
Friday, September 11, 2009
 
 
You can return your JavaScript either inside the HTML in BugDisplayEditLeft, or using an interface like IPluginStaticJS:

https://developers.fogbugz.com/default.asp?W21


api.DropListControl is a client-side API, so it is available in JavaScript code, not in server-side code.
David Fullerton Send private email
Monday, September 14, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz