Poll Module - Move poll item up

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
9/16/2007 6:48:08 AM
Gravatar
Total Posts 46

Poll Module - Move poll item up

Christian, good work on the Poll module. I'm taking a good bit of inspiration(code) for the Survey module I'm working on. In the button click event for moving a poll option up there seems to be a small bug. You reasign the swapItem back to itself which results in duplicate items in the listbox.

String tmpText = swapItem.Text;
String tmpValue = swapItem.Value;

selectedItem.Text = swapItem.Text;
selectedItem.Value = swapItem.Value;

swapItem.Text = tmpText;
swapItem.Value = tmpValue;

I think the first two lines should read..

String tmpText = selectedItem.Text;
String tmpValue = selectedItem.Value;

Cheers

Rob

 

9/17/2007 3:11:25 PM
Gravatar
Total Posts 68

Re: Poll Module - Move poll item up

Hi Rob,

this is now fixed in my sandbox. I will try and get it into trunk soon.

I've also added some graphics when showing poll results (image used only in savard2 skin right now).

Thanks,

Christian

 

9/17/2007 3:36:49 PM
Gravatar
Total Posts 46

Re: Poll Module - Move poll item up

Hi Christian, I also noticed that currently if you add an option and then try to delete it from the list it will throw an exception. It's trying to cast the value of the listbox item to a Guid but can't as it's hasn't been saved to the db at that point so doesn't have a Guid. I fixed this by adding in a similar check to the one in the Save method.

if (lbOptions.selectedtIem.Text != lbOptions.selectedItem.Value)

{

Guid optionGuid = new Guid(lbOptions.SelectedItem.Value);
PollOption option = new PollOption(optionGuid);
option.Delete();

}


lbOptions.Items.Remove(lbOptions.SelectedItem);

 

Cheers

Rob

9/17/2007 4:52:01 PM
Gravatar
Total Posts 68

Re: Poll Module - Move poll item up

Hi Rob,

This is now fixed in my sandbox.

Thanks,

Christian

You must sign in to post in the forums. This thread is closed to new posts.