Discussion for FogBugz Plugin developers
In line 87, I'm trying is to know when the client clicks the checkbox, so I can store in the DB (if is checked) "Windows" and if its not checked, then store nothing instead.
so, the problem is that I dont know when the client clicked the checkbox :).
Check out (your FogBugz install)/PluginUtils/FogCreek.Plugins.BugField/CBugField.was and look at the CBooleanBugField class -- it's written in Wasabi, but it's close enough to C# that you'll get the idea. The PopulateDialogItem and ValueFromRequest methods in particular. Do those help? We add a hidden field to make sure that the checkbox was present on the page (so we know it should be shown), and then check for the checkbox field value != null (because it will be null for a checkbox that isn't checked). Make sense?
Hey Brett, thanks for your quick reply :)
I have done some research and this is what I have found:
Public Override Sub PopulateDialogItem(item As CDialogItem, sValue As String, nArea As TabIndexArea)
Sadly I dont know how my checkbox will be correlated with this method :S.
and also this:
''' <summary>Get the value for this bug field from the HTTP request.</summary>
''' <returns>The value for the field.</returns>
Public Override Function ValueFromRequest
I understand the null comparsion but...I just dont know how to connect these 2 functions to my actual code.. :(
Maybe could you help me a bit?
It looks to me as though it's connected just fine -- what looks wrong to me is that you are setting the sInputValue (the second argument to Forms.CheckboxInput) to the current value of Convert.ToString(rgbug.GetPluginField(PLUGIN_ID, FIELD_NAME)). That probably isn't what you want -- you probably want to set it to what the value SHOULD be if the box is checked ('Windows' in this case). And then I think the logic in the 'if' statement in the lines directly above the Forms.CheckboxInput is not what you want, but it looks to me as though that has crept in while debugging this issue. Is that correct?
Great, I hope it's working well for you. I agree, the API needs better documentation, as do the utility libraries (e.g. FogCreek.Plugins.BugField) that can make what you're trying to do simpler.
Please let us know if you have any other problems, and good luck.
This topic is archived. No further replies will be accepted.Other recent topics