No token in URL after submission is rejected

More
10 months 1 week ago #188153 by LarryMartell
If I bring up a survey the token is in the URL. If I then submit the survey, but have not answered all the mandatory questions the survey is properly rejected. But when the page is redrawn the token is not in the URL. Is that a bug or is it expected? I need the token in some custom JS code I have.

Please Log in to join the conversation.

LimeSurvey Partners
More
10 months 1 week ago #188156 by jelo
The URL is not carrying any parameter during the survey. It's a cookie session.

You already have that thread here.
www.limesurvey.org/forum/installation-a-...oken-from-javascript

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

More
10 months 1 week ago #188158 by LarryMartell
Yes, that thread was about getting the token, which I am doing - I get it from the URL. But now when it's not in the URL I cannot get it.

Please Log in to join the conversation.

More
10 months 1 week ago #188159 by jelo

LarryMartell wrote: Yes, that thread was about getting the token, which I am doing - I get it from the URL.

Which only works on the first screen.

In that thread you wrote:

Ah, the token is in the URL and I can get that in the JS.


And Tpartner answered:

That will probably only work on the first screen or if using AJAX mode (which I advise against).


You still can open a bug report.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

More
10 months 1 week ago #188168 by DenisChenu
It's the needed behaviour …

To get the token in a script
<script>
var userToken = '{TOKEN}'
</script>
in custom_header.twig for template or in question text (or anything else).

Then you can use it in any script …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.

Please Log in to join the conversation.

More
10 months 1 week ago #188174 by LarryMartell
That was the first thing I had tried. It is not defined. Placeholders are not available in the custom.js file

Please Log in to join the conversation.

More
10 months 1 week ago - 10 months 1 week ago #188178 by tpartner
I agree with Denis. I don't think it's a bug but is expected behaviour.

As long as the survey is not anonymous, the {TOKEN} placeholder will be available in scripts in question text, group description text or in some theme twig files.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 10 months 1 week ago by tpartner.

Please Log in to join the conversation.

More
10 months 1 week ago #188188 by DenisChenu

LarryMartell wrote: That was the first thing I had tried. It is not defined. Placeholders are not available in the custom.js file

Can you read again my comment ?

in custom_header.twig for template or in question text (or anything else).


Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.

Please Log in to join the conversation.

More
10 months 1 week ago #188192 by LarryMartell
Where would I find the custom_header.twig file?

Please Log in to join the conversation.

More
10 months 1 week ago #188197 by tpartner

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Please Log in to join the conversation.

More
10 months 1 week ago #188199 by LarryMartell
We are running 2.73.1

Please Log in to join the conversation.

More
10 months 1 week ago #188204 by DenisChenu

LarryMartell wrote: We are running 2.73.1



Maybe best is to tell us at start …

head tag is in startpage.pstpl

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.

Please Log in to join the conversation.

More
10 months 1 week ago #188205 by tpartner
In that case, go to Configuration --> Template editor --> Your Template and try placing it in startpage.pstpl.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
The following user(s) said Thank You: LarryMartell

Please Log in to join the conversation.

More
10 months 1 week ago #188218 by LarryMartell
Thank you so much. This is just what I needed.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now