Display checkbox on 2 columns

Hello everyone,

My Adverse Event form has a checkbox response_type field (since multiple answers can be ticked for this field).
Is there a way to display the responses on 2 or 3 columns for that field, to decrease the size of the rows ?

There will be multiple adverse event and the navigation is becoming difficult due to the size of the rows.

Do you have any tips ?

Thank you,

Romain.



«1

Comments

  • jguptajgupta Posts: 17
    can you attach your CRF, so I can take a look. Have you tried changing response Layout. This layout is for configuring radio and checkbox fields. The options can be HORIZONTAL (left to right) or VERTICAL (top to bottom).
  • Csaba.HalmagyiCsaba.Halmagyi Posts: 51
    Hi Romain,

    We developed a javascript that can be used to achieve this:
    Link to the script:
    https://openclinica-testing.medschl.cam.ac.uk/js/camfetch/checkboxFormat.js

    Description (scroll down to the bottom for checkboxformat):
    https://openclinica-testing.medschl.cam.ac.uk/js/camfetch/

    Hope this helps.

    Regards,
    Csaba
  • RCHENURCHENU Posts: 155
    @jgupta : Thanks but the problem remains: this time, columns are too wide !

    @Csaba.Halmagyi : I'm going to try your script as it seems to do the job.
    Noob question: Could you tell me where I should put the script ?!?

    Thanks,

    Romain.
  • Csaba.HalmagyiCsaba.Halmagyi Posts: 51
    edited April 14
    Hi Romain,

    To test it please do the following:
    Paste this bit into the Instructions (Sections tab in the spreadsheet):
    
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 
    <script src="https://openclinica-testing.medschl.cam.ac.uk/js/camfetch/checkboxFormat.js"></script>
    (if you have multiple sections then make sure that you paste it into the section where you have the checkbox item)

    With that you include the jQuery library and the custom function.

    Then paste this bit into the left item text for your checkbox item:
    
    <div ID="checkboxdiv"></div> 
    <script> 
    jQuery(document).ready (function($) { 
    checkboxFormat("checkboxdiv", 2); }); 
    </script>
    If you would like to have 3 columns instead of 2 then replace 2 with 3 in the function argument. (when pasting these things into your crf please check whether the quotes are still the normal " double quotes as sometimes excel replaces them.)

    Let me know if you need any more help.
  • RCHENURCHENU Posts: 155
    via Email
    Thanks a lot for your clear answer. I will test it next friday as I'm out of the office for the moment.
    I will tell you if it went well !
    Thanks again,

    Romain.

    T?l?charger Outlook pour Android


    ________________________________
    From: Csaba.Halmagyi
    Sent: Friday, April 14, 2017 11:09:50 PM
    To: Romain CHENU
    Subject: Re: [OpenClinica] Display checkbox on 2 columns

    OpenClinica https://forums.openclinica.com/
    Csaba.Halmagyi commented on Display checkbox on 2 columns

    Hi Romain,

    To test it please do the following:
    Paste this bit into the Instructions (Sections tab in the spreadsheet):



    (if you have multiple sections then make sure that you paste it into the section where you have the checkbox item)

    With that you include the jQuery library and the custom function.

    Then paste this bit into the left item text for your checkbox item:



    jQuery(document).ready (function($) { checkboxFormat("checkboxdiv", 2); });

    If you would like to have 3 columns instead of 2 then replace 2 with 3 in the function argument. (when pasting these things into your crf please check whether the quotes are still the normal " double quotes as sometimes excel replaces them.)

    Let me know if you need any more help.
  • RCHENURCHENU Posts: 155
    @Csaba.Halmagyi
    Hello,
    I have a question: Is there a way to copy your script on my local server and where should I put it ?
    Because from what I see "https://openclinica-testing.medschl.cam.ac.uk/js/camfetch/checkboxFormat.js" is on your server and I would rather have the script on my machine...

    Thanks a lot for your help.

    Romain.
  • Csaba.HalmagyiCsaba.Halmagyi Posts: 51
    Hi Romain,

    Yes, that is possible. To achieve this, do the following:
    1. Visit the link (https://openclinica-testing.medschl.cam.ac.uk/js/camfetch/checkboxFormat.js) and copy the content of the page.

    2. On your laptop create a text file, paste the script and save it as checkboxFormat.js

    3. If you have a linux server than go to /usr/local/apache/webapps and create a custom directory, ie. customjavascript or something, then upload the file:
    /usr/local/apache/webapps/customjavascript/checkboxFormat.js
    (if you use windows server then find the webapps directory there)

    4.Then instead of using https://openclinica-testing.medschl.cam.ac.uk/js/camfetch/checkboxFormat.js reference in your CRF you can use http://yourserver.com:8080/customjavascript/checkboxFormat.js (in the sections)

    I guess you tried it and it worked for you. :)

    Regards,

    Csaba
  • RCHENURCHENU Posts: 155
    via Email
    Thanks again for this clear answer. I was just checking my mail but I'm still outside the office so I will give it a try on Friday.
    But I'm sure it will do the trick and I will keep you inform !
    Thanks a lot,

    Romain.

    T?l?charger Outlook pour Android


    ________________________________
    From: Csaba.Halmagyi
    Sent: Wednesday, April 19, 2017 8:40:13 PM
    To: Romain CHENU
    Subject: Re: [OpenClinica] Display checkbox on 2 columns

    OpenClinica https://forums.openclinica.com/
    Csaba.Halmagyi commented on Display checkbox on 2 columns

    Hi Romain,

    Yes, that is possible. To achieve this, do the following:
    1. Visit the link (https://openclinica-testing.medschl.cam.ac.uk/js/camfetch/checkboxFormat.js) and copy the content of the page.

    2. On your laptop create a text file, paste the script and save it as checkboxFormat.js

    3. If you have a linux server than go to /usr/local/apache/webapps and create a custom directory, ie. customjavascript or something, then upload the file:
    /usr/local/apache/webapps/customjavascript/checkboxFormat.js
    (if you use windows server then find the webapps directory there)

    4.Then instead of using https://openclinica-testing.medschl.cam.ac.uk/js/camfetch/checkboxFormat.js reference in your CRF you can use http://yourserver.com:8080/customjavascript/checkboxFormat.js (in the sections)

    I guess you tried it and it worked for you.

    Regards,

    Csaba
  • RCHENURCHENU Posts: 155
    edited April 21
    Hello Csaba,

    I followed the steps but unfortunately I couldn't make it worked. I'm using your online link for the moment, and I checked carefully the quotes but the choices are still displayed in one column.

    Do you have any idea ?

    Thank you,

    Romain.
  • Csaba.HalmagyiCsaba.Halmagyi Posts: 51
    Hi,
    Could you upload your crf here or email it to me?
Sign In or Register to comment.