+ Reply to Thread
Results 11 to 14 of 14
-
06-11-2009 01:11 PM #11
Junior Member
- Join Date
- Jun 2009
- Posts
- 3
Works great. Thanks.
-
07-02-2009 02:54 PM #12
Junior Member
- Join Date
- Jun 2009
- Posts
- 3
Can anybody post a code that can be use to programaticaly respond to a survey?
I was able to initiate the response template and by that getting the response object. But I was unable to find a method to respond to each of the items on the response items collection.
-
07-08-2009 01:52 PM #13
Administrator
- Join Date
- Mar 2007
- Location
- Prezza Technologies
- Posts
- 227
To respond to the individual items in the Response, you'll need to know something about the items. All items that have answers implement the Checkbox.Forms.Items.IAnwerable interface.
Three types of items implement this interface in Checkbox.
1) Select Items
2) Text Items
3) Matrix Items
You can query an Item object's ItemTypeName property to see what type of item it is, or you can directly check the type. Select items, such as checkboxes, radio buttons, and rating scales all extend the Checkbox.Forms.Items.SelectItem class. Single and multi-line text items extend the Checkbox.Forms.Items.TextItem class.
To set answers for select items, call the Select(...) method, which accepts a list of selected option ids (which you can get from SelectItem.Options property) as well as any text entered in the "Other" text input.
//Select multiple options for checkboxes
((SelectItem)item).Select(new[] {1002, 1004});
//Select radio button option and other text
((SelectItem)item).Select("Other", new[] {1002, 1004});
For text items, the answer can be set by calling the SetAnswer(...) method defined by the IAnswerable interface.
((TextItem)item).SetAnswer("This is the answer.");
Matrix questions are only slightly more difficult. A Matrix question is actually a composite item comprised of child Message, Text, and Select items. To provider answers to items within the matrix, you can get the child item by its ID or iterate through the rows and columns to find child items. Once you have a reference to the child item, set its answer as illustrated above.
-
07-09-2009 12:15 AM #14
Junior Member
- Join Date
- Jun 2009
- Posts
- 3
Thanks for reply. I was able to get this work as you explained. But now I am facing a challenge to implement this functionality in my custom application as I use Microsoft Enterprise library and hence I can not have configuration entries on the web.config which needed by the Chceckbox API.
Do you know any simple solution or any other methodology that I can use here?
Thanks.
Chaminda


LinkBack URL
About LinkBacks
Reply With Quote
