Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

No token in URL after submission is rejected

  • LarryMartell
  • LarryMartell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
4 years 7 months ago #188153 by LarryMartell
No token in URL after submission is rejected was created 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.
The topic has been locked.
More
4 years 7 months 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
The topic has been locked.
  • LarryMartell
  • LarryMartell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
4 years 7 months ago #188158 by LarryMartell
Replied by LarryMartell on topic No token in URL after submission is rejected
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.
The topic has been locked.
More
4 years 7 months 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
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188168 by DenisChenu
Replied by DenisChenu on topic No token in URL after submission is rejected
It's the needed behaviour …

To get the token in a script
Code:
<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.
The topic has been locked.
  • LarryMartell
  • LarryMartell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
4 years 7 months ago #188174 by LarryMartell
Replied by LarryMartell on topic No token in URL after submission is rejected
That was the first thing I had tried. It is not defined. Placeholders are not available in the custom.js file
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago - 4 years 7 months ago #188178 by tpartner
Replied by tpartner on topic No token in URL after submission is rejected
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.
Last edit: 4 years 7 months ago by tpartner.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188188 by DenisChenu
Replied by DenisChenu on topic No token in URL after submission is rejected

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.
The topic has been locked.
  • LarryMartell
  • LarryMartell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
4 years 7 months ago #188192 by LarryMartell
Replied by LarryMartell on topic No token in URL after submission is rejected
Where would I find the custom_header.twig file?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188197 by tpartner
Replied by tpartner on topic No token in URL after submission is rejected

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • LarryMartell
  • LarryMartell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
4 years 7 months ago #188199 by LarryMartell
Replied by LarryMartell on topic No token in URL after submission is rejected
We are running 2.73.1
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188204 by DenisChenu
Replied by DenisChenu on topic No token in URL after submission is rejected

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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose