Check out the LimeSurvey source code on GitHub!

Custom check boxes and radio buttons

More
6 years 4 weeks ago #54457 by holch
Hi Shnoulle,

Thanks for the hint. I did not comment jquery-ui.js, at least not intentionally. But it is possible that I messed it up somehow, because I was working in the LS Template Editor, and not in my normal editor.

I will have a look at this.

Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
6 years 4 weeks ago - 6 years 3 weeks ago #54473 by tpartner
Okay, it seems that there is a jQuery conflict and the plugin won't work with the shipped version of jQuery so we need a trick.

1) Go to pixelmatrixdesign.com/uniform/ , download the plugin and install the following files/folders in your template directory:
- jquery.uniform.min.js (file)
- /images (folder)
- /css (folder)

2) Go to jquery.com/ , download the latest version and install it in your template directory

3) Add the following to the beginning of your startpage.pstpl. The code will:
- link to the plugin css file
- replace the link to the shipped jQuery file with a link the new version you just installed
- link to the plugin JS file.
<link rel="stylesheet" type="text/css" href="{TEMPLATEURL}/css/uniform.default.css" />
<script type="text/javascript">
    $(document).ready(function() {
        $('script[src*="/jquery/jquery.js"]').attr('src', '{TEMPLATEURL}jquery-1.4.4.min.js');
    });
</script>
<script type="text/javascript" src="{TEMPLATEURL}jquery.uniform.min.js"></script>

Add the following to the end of template.js. It will apply the plugin script to all radio, checkbox, dropdown and browser upload elements in the survey:
$(document).ready(function() {
	$('select, input:checkbox, input:radio, input:file').uniform();
});

I've tested back to IE7 and, although IE7 is a little slow to apply the plugin, voila!


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last Edit: 6 years 3 weeks ago by DenisChenu. Reason: Add a space betwwen link an , ;)

Please Log in to join the conversation.

More
6 years 4 weeks ago #54475 by holch
Hi Toni!

Looks good. I will give it a try tonight and give feedback.

If all works well and I know how to do it, I will create a alternative how to in the workaround sections.

Wouldn't be the implementation of this into core be a good task for that Google project, or is this already over?

Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
6 years 17 hours ago - 6 years 17 hours ago #55194 by ftrifoglio
I came across this thread and I found it helpful, but I get some issues.

I downloaded the jquery.uniform.zip and I uploaded the files/folder into ../upload/templates/my_template directory.

I downloaded the jquery-1.4.4.min* and I uploaded it into the same directory above.

Then I add the codes to startpage.pstpl and template.js.

But what does it mean "replace the link to the shipped jQuery file with a link the new version you just installed"?

Maybe the code to add to the startpage.pstpl should look like this
<link rel="stylesheet" type="text/css" href="{TEMPLATEURL}/css/uniform.default.css" />
<script type="text/javascript">
    $(document).ready(function() {
        $('script[src*=""]').attr('src', '{TEMPLATEURL}jquery-1.4.4.min*');
    });
</script>
<script type="text/javascript" src="{TEMPLATEURL}jquery.uniform.min.js"></script>

*I dropped the .js otherwise it didn't show it.

If it so, it doesn't work.
Last Edit: 6 years 17 hours ago by ftrifoglio.

Please Log in to join the conversation.

More
6 years 16 hours ago #55195 by Mazi

ftrifoglio wrote: But what does it mean "replace the link to the shipped jQuery file with a link the new version you just installed"?

At the beginning of the template the jQuery core file is included (in startpage.pstpl I guess). You have to change that link to the new version of that file.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
6 years 15 hours ago - 6 years 15 hours ago #55203 by ftrifoglio
my startpage.pstpl includes just the template.css and the template.js

I tried to add the following line then but nothing yet.
<script type="text/javascript" src="{TEMPLATEURL}jquery-1.4.4.min"></script>

Then I noticed that if I do all that stuff the progress bar disappear.
Last Edit: 6 years 15 hours ago by ftrifoglio.

Please Log in to join the conversation.

More
6 years 14 hours ago - 6 years 14 hours ago #55219 by tpartner
Hmm...seems that the code got mangled in my original post. The code to be added to the beginning of startpage.pstpl should be:

File Attachment:

File Name: new_2_2011-01-18.txt
File Size:0 KB



This code, among other things, will change the source of the original link to jQuery to the new file you have included in your template. This means that only the new jQuery is loaded so there is no conflict.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last Edit: 6 years 14 hours ago by tpartner.

Please Log in to join the conversation.

More
6 years 14 hours ago - 6 years 14 hours ago #55221 by tpartner
Okay, this forum software is pissing me off! It won't let me insert the code. Line 5 in the above should be as in the attached.

File Attachment:

File Name: new_2.txt
File Size:0 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last Edit: 6 years 14 hours ago by tpartner.

Please Log in to join the conversation.

More
6 years 13 hours ago #55231 by ftrifoglio
ok it makes sense now, but still don't work for me.

it looks like that on chrome8 (but also in ie9). In firefox3 it's like nothing changed.





the progress bar disappears and just the first radio button looks as it should be but it's not selectable.
Attachments:

Please Log in to join the conversation.

More
6 years 6 hours ago #55264 by ftrifoglio
I followed what did holch in this survey www.ivp-surveys.com/sc/091SL/index.php?sid=29851&lang=en

I added the following code to the startpage.pstpl

File Attachment:

File Name: 2.txt
File Size:1 KB


Everything is ok but the progress bar disappears and the radio button are not markable. Actually they are but you have to click on the label. In the array the radio buttons work fine.
Attachments:

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form