Plugin Developer Discussion

Discussion for FogBugz Plugin developers

Buttons and postbacks

Hi there.

could you provide a sample showing use of buttons for simple postback?

the current samples use dialog and editabletable as far as I could see....
Espen Halsaa Albrektsen Send private email
Sunday, August 2, 2009
 
 
I figured it out - as allways, it was quite simple:

Step1: Surround everything with a "<form> block:
Step2: Remember to AddPluginPrefix to the submit button:

Sample code:
StringBuilder reportSelector = new StringBuilder();
            reportSelector.AppendFormat(@"
                    <form action=""{0}"" method=""POST"">
                    <input type=""hidden"" name=""{1}actionToken"" value=""{2}"" />",
                api.Url.PluginPageUrl(),
                api.PluginPrefix,
                api.Security.GetActionToken("createReport"));
var inputTable = new CEditableTable(api.AddPluginPrefix("ReportParameters"));

// Add the controls (dates, text etc removed for clarity

// Add the buttons:            inputTable.Footer.AddCell(Forms.SubmitButton(api.AddPluginPrefix("renderByProject"), "By project"));            inputTable.Footer.AddCell(Forms.SubmitButton(api.AddPluginPrefix("renderByPerson"), "By person"));            reportSelector.AppendLine(inputTable.RenderHtml());
            reportSelector.AppendLine("</form>");
Espen Halsaa Albrektsen Send private email
Sunday, August 2, 2009
 
 
Glad to hear you figured it out.  I've opened a case to add a simple form submission example.
David Fullerton Send private email
Tuesday, August 4, 2009
 
 
I have added links to the "How to handle post-backs" article (W41) for two simpler examples: IPluginConfigPageDisplay and Implementing IPluginPageDisplay. These two examples use forms with only a few elements.
Adam Wishneusky Send private email
Tuesday, August 4, 2009
 
 

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

Other recent topics Other recent topics
 
Powered by FogBugz