Saving to LS, but submitting to an external site

More
5 years 6 months ago #79739 by DenisChenu
DenisChenu replied the topic: Saving to LS, but submitting to an external site

hrshdhgd wrote: and it is in 'startpage.pstpl'

Think it's best to put it directly in group description.

First:
- remove all hide function
- With the real question number, test with:
$('#question13732 input.text').val(workerId);
$('#question13733 input.text').val(assignmentId);
$('#question13734 input.text').val(hitId);

If it don't work, test with:
$('#question13732 input.text').val("TEST");
$('#question13733 input.text').val("TESTassignmentId");
$('#question13734 input.text').val("TESThitId");

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 6 months ago #79743 by hrshdhgd
hrshdhgd replied the topic: Saving to LS, but submitting to an external site
I tried both codes. No difference noticed. I have attached a screenshot of my database. Nothing gets populated in the three fields for the IDs using both codes.
Thanks,
H.
Attachments:

Please Log in to join the conversation.

More
5 years 6 months ago #79781 by DenisChenu
DenisChenu replied the topic: Saving to LS, but submitting to an external site
There are some problem with your javascript then.

It's very difficult to help you without an access on the server.

You can see the real id for inout with Firebug for example.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 6 months ago #79805 by hrshdhgd
hrshdhgd replied the topic: Saving to LS, but submitting to an external site
I have sent you a private message with the details to access the survey. Hope it helps,

Thanks,
H.

Please Log in to join the conversation.

More
5 years 6 months ago #79815 by DenisChenu
DenisChenu replied the topic: Saving to LS, but submitting to an external site
Hello,

You use "allways hide this question", don't use it: the answer aren't in DOM if this question is hidden like that.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 6 months ago - 5 years 6 months ago #79816 by hrshdhgd
hrshdhgd replied the topic: Saving to LS, but submitting to an external site
Ok. So what should I do next?

I was asked to save the info (Ids) into a hidden question (if you refer the thread) and I thought thats how it should be done! Is there anything I am missing?

Thanks,
H.
Last Edit: 5 years 6 months ago by hrshdhgd.

Please Log in to join the conversation.

More
5 years 6 months ago #79817 by DenisChenu
DenisChenu replied the topic: Saving to LS, but submitting to an external site

hrshdhgd wrote: Ok. So what should I do next?

Did it work ? If you show the answer, you see the answer filled ?

If yes, i think you can hide the question with relevance to 0. But you hide oit to in javascript with $("#question100").hide();
The question are hide in CSS not in HTML source, the javascript can access it.

I was asked to save the info (Ids) into a hidden question (if you refer the thread)

Saving to LS, but submitting to an external site ;) and there are more than one solution in the topic :).

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 6 months ago #79819 by hrshdhgd
hrshdhgd replied the topic: Saving to LS, but submitting to an external site

Did it work ? If you show the answer, you see the answer filled ?


Nope, unfortunately that did not work! I tried both:
$('input#answer78151X412X13732').val(workerId);
and
$('#question13732 input.text').val(workerId);

by making the questions visible, neither of them worked.


Any other suggestions?

Thanks,
H

Please Log in to join the conversation.

More
5 years 6 months ago - 5 years 6 months ago #79841 by DenisChenu
DenisChenu replied the topic: Saving to LS, but submitting to an external site
Hello,

Remove all script from startpage.pstpl or endpage.pstpl.

Put the script in template.js.
function getURLParameter(name) {
    return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
}
 
 
$(document).ready(function(){
  var assignmentId = getURLParameter('assignmentId');
  var hitId = getURLParameter('hitId');
  var workerId = getURLParameter('workerId');
 
  $('#question13732 input.text').val(workerId);
  $('#question13733 input.text').val(assignmentId);
  $('#question13734 input.text').val(hitId);	
});

tested and working for me.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 5 years 6 months ago by DenisChenu.

Please Log in to join the conversation.

More
5 years 6 months ago #79845 by hrshdhgd
hrshdhgd replied the topic: Saving to LS, but submitting to an external site

Remove all script from startpage.pstpl or endpage.pstpl.

Put the script in template.js.

function getURLParameter(name) {
    return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
}
 
 
$(document).ready(function(){
  var assignmentId = getURLParameter('assignmentId');
  var hitId = getURLParameter('hitId');
  var workerId = getURLParameter('workerId');
 
  $('#question13732 input.text').val(workerId);
  $('#question13733 input.text').val(assignmentId);
  $('#question13734 input.text').val(hitId);	
});

tested and working for me.

Denis

I did exactly as you instructed, deactivated and reactivated both Amazon Mechanical Turk and LimeSurvey. It still does not show as answers to the questions (which are visible) and the responses in the database is blank. I really appreciate all your patience and help so far but I still don't understand why is it not working for me.

Thanks,
H

Please Log in to join the conversation.

More
5 years 6 months ago #79846 by DenisChenu
DenisChenu replied the topic: Saving to LS, but submitting to an external site
input.text : short question answer

If it's not a short question answer, it can be textarea
$('#question13732 textarea').val(workerId);

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 6 months ago #79847 by hrshdhgd
hrshdhgd replied the topic: Saving to LS, but submitting to an external site
YES!!!!!! it finally worked! Thanks a lot for all your effort! You are the BOSS!!

Please Log in to join the conversation.

More
5 years 6 months ago #79849 by DenisChenu
DenisChenu replied the topic: Saving to LS, but submitting to an external site

You're welcome :-)

If our hints have been helpful and you enjoy limesurvey please consider a donation to give Limesurvey a future .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.

;)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
4 years 5 months ago #96522 by gorp
gorp replied the topic: Saving to LS, but submitting to an external site
Hi thank you for a good thread! Im about to attempt extracting the worker id from mechanical turk; however how do I try it out using mechanical turk?

Where in the startpage.pstpl file am I suppose to add the following:
$('#question421 input.text').val(workerId);
$('#question input.text').val(assignmentId);
$('#question13734 input.text').val(hitId);


anywhere?
Any help is much appreciated.
Kind Regards
Oscar

Please Log in to join the conversation.

More
4 years 5 months ago - 4 years 5 months ago #96576 by gorp
gorp replied the topic: Saving to LS, but submitting to an external site
Hey,
I've not yet managed to implement the suggestions in this thread properly. However, I've tried to use the option to save referral url that limesurvey gives when activating a survey. This manage to save the referal url from e.g., facebook however NOT from mechanical turk.

Does anyone know if the suggestions in this thread will work or if mechanical turk has changed something?

Thanks
Oscar
Last Edit: 4 years 5 months ago by gorp.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!