- Posts: 50
- Thank you received: 11
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
passthrough list(radio) answer conflicts with jquery-1.7.1.min.js
- byan
- Topic Author
- Offline
- Senior Member
Less
More
10 years 1 week ago #106349
by byan
passthrough list(radio) answer conflicts with jquery-1.7.1.min.js was created by byan
Hi, there
I have used the following jQuery code to successfully set the default value of a list(radio) question based on the passthrough value. However, after I added <script src=" code.jquery.com/jquery-1.7.1.min.js "> before the following code, the default value was no longer set. Any hint? Thanks!
<script type="text/javascript" charset="utf-8">
//The code is put in the help box
var passStr = "{INSERTANS:527775X3X21}";
var passNum = passStr.replace(/<\/?[^>]+(>|$)/g, "");
if (passNum != null) {
var qID = {QID};
$('#question'+qID+' input.radio:eq('+passNum+')').click();
}
</script>
I have used the following jQuery code to successfully set the default value of a list(radio) question based on the passthrough value. However, after I added <script src=" code.jquery.com/jquery-1.7.1.min.js "> before the following code, the default value was no longer set. Any hint? Thanks!
<script type="text/javascript" charset="utf-8">
//The code is put in the help box
var passStr = "{INSERTANS:527775X3X21}";
var passNum = passStr.replace(/<\/?[^>]+(>|$)/g, "");
if (passNum != null) {
var qID = {QID};
$('#question'+qID+' input.radio:eq('+passNum+')').click();
}
</script>
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
10 years 1 week ago #106356
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 passthrough list(radio) answer conflicts with jquery-1.7.1.min.js
Why would you add that? jQuery is already included.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- byan
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 50
- Thank you received: 11
10 years 1 week ago - 10 years 1 week ago #106374
by byan
Replied by byan on topic passthrough list(radio) answer conflicts with jquery-1.7.1.min.js
I was trying to implement Ajax to do autosuggestion based on a MySQL table directly rather than the csv table approach presented in the workarounds documentation, which requires jquery-1.7.1.min.js. Without it, the autosuggestion wouldn't work.
BTW, I have solved the problem by using the following simple JavaScript line:
document.getElementById("answer548129X1X" + passGrouping).checked = true;
BTW, I have solved the problem by using the following simple JavaScript line:
document.getElementById("answer548129X1X" + passGrouping).checked = true;
Last edit: 10 years 1 week ago by byan.
The topic has been locked.