- Posts: 38
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Using Javascript to replace text on #tokenmessage
- stemate1988
- Topic Author
- Offline
- Junior Member
Less
More
8 years 8 months ago #122647
by stemate1988
Using Javascript to replace text on #tokenmessage was created by stemate1988
Morning,
I have a bit of jquery which i want to use to replace some text in the #tokenmessage.
I want 'Please contact' to be replaced.
$("#tokenmessage p").text($("#tokenmessage p").text().replace("Please contact", "It looks as though you’ve recently completed the survey and provided your feedback. Unfortunately, we’re only able to accept one survey per applicant"));
Is this possible and where would the code have to sit?
I have a bit of jquery which i want to use to replace some text in the #tokenmessage.
I want 'Please contact' to be replaced.
$("#tokenmessage p").text($("#tokenmessage p").text().replace("Please contact", "It looks as though you’ve recently completed the survey and provided your feedback. Unfortunately, we’re only able to accept one survey per applicant"));
Is this possible and where would the code have to sit?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
8 years 8 months ago #122650
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 Using Javascript to replace text on #tokenmessage
It would probably be easier to replace the whole token message. Something like this at the end of template.js:
Code:
$(document).ready(function() { // Define the new message var newMessage = 'We are sorry but you are not allowed to enter this survey.<br><br>\ This invitation has already been used.<br><br>\ It looks as though you’ve recently completed the survey and provided your feedback. Unfortunately, we’re only able to accept one survey per applicant.'; // Insert the new message (only if the token form is missing) if($('#tokenmessage').length > 0 && $('#tokenform').length == 0) { $('#tokenmessage').html(newMessage); } });
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- stemate1988
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 38
- Thank you received: 0
8 years 8 months ago #122653
by stemate1988
Replied by stemate1988 on topic Using Javascript to replace text on #tokenmessage
That's spot on tpartner, thanks for your help!
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13907
- Thank you received: 2546
8 years 8 months ago #122673
by DenisChenu
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.
Replied by DenisChenu on topic Using Javascript to replace text on #tokenmessage
No cross post please !
www.limesurvey.org/en/community-services...text-on-tokenmessage
www.limesurvey.org/en/community-services...text-on-tokenmessage
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.
- MSMSEVN
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
5 years 10 months ago #168791
by MSMSEVN
Replied by MSMSEVN on topic Using Javascript to replace text on #tokenmessage
Sorry I faced problem when I were using JavaScript to replace text on #token message.
I changed the token text and token label, but I can't change the warning message in case of invalid token.
I attached the script that I've been using in my survey.
Help me,please!
Thank you so much.
I changed the token text and token label, but I can't change the warning message in case of invalid token.
I attached the script that I've been using in my survey.
Help me,please!
Thank you so much.
Attachments:
The topic has been locked.