Save custom data to a field in the database

More
7 months 3 weeks ago #172791 by samh11
I would like to generate HTML code and save it to a column/field in the database.

I've created a hidden question with 'sHTML' code which corresponds to the column/field
in the survey table I would like to save the HTML.

I've also created a plugin and it handles the afterSurveyComplete event.

Can I read the survey/response from the database and then modify the sHTML column
and update the modified record to the database?

I've tried reading the survey/response from the database using the internal API calls, but it doesn't appear to read the record.

I assume the record is created at this point since I'm in the afterSurveyComplete but maybe the record hasn't been created yet.

Does anyone know how to go about handling the above situation?

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
7 months 3 weeks ago #172812 by tpartner
The record is created after submission of the first question page, regardless of whether the survey is complete.

If you cannot load the hidden (presumably long-text-type) question from within the survey, how about using the API update_response() method - api.limesurvey.org/classes/remotecontrol...thod_update_response .

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!