Go Back   CHECKBOX® Online Community > Checkbox® > CHECKBOX® Developer Kit

Reply Bookmark and Share
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 04-29-2008, 05:02 PM
toolbox
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by ncushing View Post
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.
I have been using the sample website, but have noticed that the save feature isn't working quite right. When I click the save button, the page says that answers have been successfully updated, but when I leave and then come back to the survey, or view the results in the checkbox app, the answers have not been changed.

Any idea what I need to update/change in the same app to get that to update correctly?

Thanks
Reply With Quote
  #12 (permalink)  
Old 05-02-2008, 11:04 AM
toolbox
Guest
 
Posts: n/a
Default

Here is the code in the app for saving the new results:

//Reload the current response, which is necessary because the response object does not have a lifecycle
// beyond the a single postback in the application. This will eventually change, but for now the
// response must be reloaded to prevent item IsValid states from getting confused.
LoadCurrentResponse();

bool valid = true;

if (_itemRenderers != null)
{
foreach (ItemRenderer renderer in _itemRenderers)
{
//Update the model
renderer.UpdateModel();

if (renderer.Model is ResponseItem)
{
valid = valid & ((ResponseItem)renderer.Model).Valid;
}

//Rebind the renderer to the model to cause the validation errors to show
// current state of the Model.
renderer.BindModel();
}

_answersUpdatedLbl.Visible = valid;
_validationErrorLbl.Visible = !_answersUpdatedLbl.Visible;

//Save the response state
CurrentResponse.SaveCurrentState();
}

After trying several things, I found that if I commented out the LoadCurrentResponse(); the new answers were saved correctly, and everything else still appears to work.
Reply With Quote
  #13 (permalink)  
Old 04-20-2009, 01:02 PM
Junior Member
 
Join Date: Jan 2009
Posts: 8
Default

Dusting off this thread...
- the fix above of commenting out LoadCurrentResponse() also worked for me.

- I find some settings in the config folder's XML files confusing, they conflict with settings in our running version of Checkbox Server.

- in particular, I wonder if the settings in Cache.XML where the security, text, response and template cache managers are set to 'true' (in our live system they're false) are causing some behavior I can't understand:

* if I change the template style to use numbered questions, CurrentSurvey in the OnePage application still shows the setting as false.

* if I change the template style's title or next/back labels to anything else, they never change in the OnePage app.

Suggestions?

Thanks,
Per
Reply With Quote
  #14 (permalink)  
Old 05-04-2009, 06:29 PM
Administrator
 
Join Date: Mar 2007
Location: Prezza Technologies
Posts: 200
Default

I'm pretty sure the one-page app replicates the functionality of the ViewResponseDetails screen, which does not use a survey's style template or style settings for rendering the page. You would have to modify the application if you wanted it to use those settings.

Settings that control display of page numbers and the like are properties of the ResponseTemplate object, and the actual style definitions are part of the StyleTemplate object associated with the survey. The StyleTemplateManager class can be used to load a style given it's database id.
Reply With Quote
  #15 (permalink)  
Old 05-05-2009, 10:10 AM
Junior Member
 
Join Date: Jan 2009
Posts: 8
Default

I'll take another look at the Style stuff.

But I don't think that the app replicates the ViewResponseDetails page because it shows the response in edit mode , not view mode. E.g. all the HTML controls are shown, not the values of the answers.

Per
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 03:04 PM.


SEO by vBSEO 3.2.0