Thank you for your inquiry. I know there are others looking for similar information, so I'll try to make this an in-depth post. I'll gather the information I need on my end and update this thread later today.
...answers when you need them
I am currently working a c#.net page where I can allow a user to review a survey outside of the checkbox web app. I need to do this because the this is a mult-page survey and I don't want to make the reviewer go through page by page. Here is what I need to do:
1. Get a list of all the users response answers
2. Loop through these response answers and using the API, get the HTML each question would render in the checkbox web app. or an instance of the control I can add to my page.
3. Then after review, I will need to be able to save any changes
Thank you for your inquiry. I know there are others looking for similar information, so I'll try to make this an in-depth post. I'll gather the information I need on my end and update this thread later today.
I'll have to do this in multiple parts, since I'll be building and testing things on my end to go with this. To get started, I assume that you will be hosting this logic in a web application other than the Checkbox web application. If so, the first step will be to add the following sections from the Checkbox web.config to the web.config for the application that will be hosting the custom code:
Code:
You will need to replace [YOUR_APP_PATH] with the actual physical location of the web application (e.g. c:\inetpub\wwwroot\myapp) and will need to update the connection string to point to your Checkbox database.
Next, you'll need to copy all files from the Config folder of your Checkbox installation to your new application location, then modify any filePath attributes in the XML configuration files to point to your new application location. The following list shows the files that need to be updated.
- BackingStore.xml (1 Change)
- Cache.xml (10 Changes)
- CheckboxSecurity.xml (1 Change)
- ExceptionHandling.xml (5 Changes)
- GlobalizationConfiguration.xml (1 Change)
- Logging.xml (4 Changes)
- Messaging.xml (1 Change)
- Security.xml (10 Changes)
To be continued...
Thanks for the help so far, looking forward to the next step.
Toolbox,
Rather than paste bits of code into the message, I created a sample web application that shows a list of surveys and responses. Upon selection of a response, all answerable questions are displayed on a single page along with their current answers. The user can then change the answers and save those changes.
To run the application, extract the files to a folder, then create a virtual directory in IIS to point to the folder . Then you'll need to update the connection string in the web.config and will need to update the web.config and all config files to replace [APP_PATH] with the physical location of the folder containing the application (e.g. C:\WebRoot\OnePageSurvey\) so that the various configuration files are referenced by their full paths.
Hopefully this will be a good start for you to adapt to your needs. If you have any questions, please let me know.
Thanks for the help on this. That application is great. I have just one question. How do I display some hidden items I have on that survey. They are returned in the surveypage.Items collection, but they appear to not have an item appearance when calling the AppearanceDataManager.GetAppearanceDataForItem()
Thanks for your help.
It is not possible to display hidden items, it is for this reason that AppearanceDataManager.GetAppearanceDataForItem() returns no value for them.
I know that the system will hide them while someone is taken a survey, but when using the checkbox web application, and reviewing a survey, all the hidden values are displayed. If this functionality is not available in the API, I would agree that it isn't possible to display them. However, if the same functionality is available in the API as is used in the application, there must be a way to display them.
Hidden items are essentially the same as open-ended questions, except that they read the values from query string, session, or cookie instead of a text input.
To display these items and allow a user to edit them, you would have to manually create a text box and populate it with the hidden item value. On postback, you would then update the hidden item (HiddenItem object) with the value of the textbox at the same times you call UpdateModel(...).