Plugin Developer Discussion

Discussion for FogBugz Plugin developers

CheckboxInput how to detect changes

Hey guys, I'm trying to use the
CheckboxInput(String, String, Boolean, String)
Method.

everything works as expected BUT, I just cant find what's the value that the checkbox has in a certain moment (selected (true) or deselected(false))

any ideas ? :)
Juan Sebastian Muñoz Send private email
Tuesday, November 24, 2009
 
 
Hi Juan-
Do you mean on the server side, or in Javascript on the client side?
Thanks!
Brett
Brett Kiefer Send private email
Tuesday, November 24, 2009
 
 
Hey Brett,

http://pastie.org/714190

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 :).

Best!
Juan
Juan Sebastian Muñoz Send private email
Wednesday, November 25, 2009
 
 
Hi Juan-
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?
Thanks!
Brett
Brett Kiefer Send private email
Wednesday, November 25, 2009
 
 
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?
Juan Sebastian Muñoz Send private email
Thursday, November 26, 2009
 
 
Hi Juan-
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[0].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?
Thanks!
Brett
Brett Kiefer Send private email
Friday, November 27, 2009
 
 
Hey Brett! :)
We made it work but not without checkboxes :(.
still thanks for your help! :)

BTW your API needs more documentation :) also examples are really useful!

Cheers!
Juan
Juan Sebastian Muñoz Send private email
Friday, November 27, 2009
 
 
Hi Juan-
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.
Thanks!
Brett
Brett Kiefer Send private email
Friday, November 27, 2009
 
 

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

Other recent topics Other recent topics
 
Powered by FogBugz