- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
End survey by click on URL
- niolou
- Topic Author
- Offline
- New Member
Less
More
7 years 8 months ago #138094
by niolou
End survey by click on URL was created by niolou
Hello,
I'm trying to create a survey where the user would react to the satisfaction of solving his request.
The email have only two links:
Yes I was satisfied
url + ticketID + yes (web thank you for your rating)
I was not satisfied
url + ticketID + no (classical survey)
I know how to send parameters by url (index.php/436483?lang=cs¶m1=TicketID¶m2=yes)
I would like to closed the survey by clicking on the url and save the rating and I don´t know how?
Thank you for your advice
I'm trying to create a survey where the user would react to the satisfaction of solving his request.
The email have only two links:
Yes I was satisfied
url + ticketID + yes (web thank you for your rating)
I was not satisfied
url + ticketID + no (classical survey)
I know how to send parameters by url (index.php/436483?lang=cs¶m1=TicketID¶m2=yes)
I would like to closed the survey by clicking on the url and save the rating and I don´t know how?
Thank you for your advice
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10613
- Thank you received: 3691
7 years 8 months ago #138102
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic End survey by click on URL
It seems to me that you should be using the
RemoteControl 2 API
with the
add_response() method
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- niolou
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
7 years 8 months ago #138161
by niolou
Replied by niolou on topic End survey by click on URL
It looks fine, but I don´t know how to use it.
I activate service RPC - JSON-RPC.
Could you send me example what next how to use method?
Thx
I activate service RPC - JSON-RPC.
Could you send me example what next how to use method?
Thx
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10613
- Thank you received: 3691
7 years 8 months ago #138171
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic End survey by click on URL
You would need to post to a PHP file that would insert the response via the API.
A simplified version of that PHP file would look something like this. The $param1Sgq and $param2Sgq variables are the database column names for the questions (or the SGQ values).
A simplified version of that PHP file would look something like this. The $param1Sgq and $param2Sgq variables are the database column names for the questions (or the SGQ values).
Code:
<?php require_once 'path/to/jsonRPCClient.php'; define( 'LS_BASEURL', 'http://path/to/limeSurvey/'); define( 'LS_USER', 'limesurvey_admin_name' ); define( 'LS_PASSWORD', 'limesurvey_admin_password' ); define( 'LS_DB_HOST', 'localhost' ); define( 'LS_DB_NAME', 'database_name' ); define( 'LS_DB_USER', 'database_user' ); define( 'LS_DB_PASS', 'database_password' ); define( 'LS_DB_TABLEPREFIX', 'lime_' ); // Define some vars $param1Sgq = '111111X22X333'; $param1Answer = $_POST['param1']; $param2Sgq = '111111X22X334'; $param2Answer = $_POST['param2']; $esgq = explode('X', $param1Sgq); $sid = $esgq[0]; if(ctype_alnum($sid) && strlen($sid) == 6) { // Valid SID format // Instantiate a new RPC client $myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' ); // Get a session key $sessionKey = $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD ); // Build an array of response data $aResponseData = array($param1Sgq=>$param1Answer, $param2Sgq=>$param2Answer); // Add a response set $addResponse= $myJSONRPCClient->add_response($sessionKey, $sid, $aResponseData); // You could do something with the response ID here //echo $addResponse; // Release the session key $myJSONRPCClient->release_session_key( $sessionKey ); } else { // Invalid SID format die( 'Invalid format!' ); } ?>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Ben_V
The topic has been locked.