Welcome to the LimeSurvey Community Forum

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

How Can I activate a Javascript Library ?

  • GuilleVargas
  • GuilleVargas's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #174224 by GuilleVargas
How Can I activate a Javascript Library ? was created by GuilleVargas
Hello everybody,

I am interested in add a javascript library in order to be able to record voices on a survey.
This is the library : github.com/higuma/web-audio-recorder-js

The question is: where I should add this library? Should I make a plugin for it? I am looking inside limesurvey and there is a folder named "Third-Party". So I was wondering if that is the place in which I should add this library…

If you have any ideas or suggestions, I will really appreciate it…

Regards, Guillo
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 6 months ago #174226 by LouisGac
Replied by LouisGac on topic How Can I activate a Javascript Library ?
if it's for front end extend a theme and edit the manifest
manual.limesurvey.org/New_Template_Syste...a_theme_from_scratch
The topic has been locked.
  • GuilleVargas
  • GuilleVargas's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #174228 by GuilleVargas
Replied by GuilleVargas on topic How Can I activate a Javascript Library ?
Hello LouisGac,

The real goal is to add a voice-recorder button to the survey. I was expecting to just add a script on the code section of questions, in order to call the function to insert a voice recorder button on the question ( in-tissu.artandfield.org/collecte-de-recits/ ).

This will be the very first time that I will transform limesurvey. So I am not sure of anything. I have been looking the way some plugins works. Unfortunately, anyone is adding a javascript functionality to a question on a survey. I have some knowledge on html, css and php, but Javascript is entirely new for me. I can read instructions and examples, and be able to learn quickly...

I am not sure that making a theme is what I need to do right here, but you know better than me how limesurvey works, so I will follow your suggestions. Do you think that I should create a theme in order to reach my goal?

Probably my first question is not clear enough: How can I use the WebAudioRecorder.js function on a limesurvey survey?
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 6 months ago - 5 years 6 months ago #174230 by LouisGac
Replied by LouisGac on topic How Can I activate a Javascript Library ?
indeed, you'd rather create a question theme for that.

some doc here (read it entirely):
github.com/LimeSurvey/LimeSurvey/tree/master/themes/question

Look in details how we customized the multiple choice question, to add the "bootstrap button" theme.
Here the original code of multiple choice:
github.com/LimeSurvey/LimeSurvey/tree/ma...nswer/multiplechoice

here the customized version to use bootstrap button instead of checkboxes:
github.com/LimeSurvey/LimeSurvey/tree/ma...nswer/multiplechoice

it uses specific JS:
github.com/LimeSurvey/LimeSurvey/tree/ma...hoice/assets/scripts

it is registered in the manifest of the question theme:
github.com/LimeSurvey/LimeSurvey/blob/ma...hoice/config.xml#L31

because you want to save a sound file, I suggest you to extend the upload question type:
github.com/LimeSurvey/LimeSurvey/tree/ma...s/answer/file_upload



So here how I suggest you to proceed:

1. Try to make a custom PHP script using your JS lib to save some sound in a server. Not using limesurvey at all, just pure PHP. So you'll be sure you understood how to do it from scratch, and that you're using correctly the js lib, not being confused by LS specific problems.

2. Try to create a very simple question theme for LimeSurvey. Just to be sure you understand how it works. Loading a JS script file showing a "hello world" at load would be fine. So you'll be sure you understood question theming, not being confused by your JS lib specific problems

3. Then, customize the upload question type to use your library and to save the record file :
github.com/LimeSurvey/LimeSurvey/tree/ma...s/answer/file_upload

good luck ;)
Last edit: 5 years 6 months ago by LouisGac.
The topic has been locked.
  • GuilleVargas
  • GuilleVargas's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #174231 by GuilleVargas
Replied by GuilleVargas on topic How Can I activate a Javascript Library ?
Perfect ! So now I have some work to do !!!

I will be back soon to give you news about this.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174233 by holch
Replied by holch on topic How Can I activate a Javascript Library ?
And once that works, give it back to the community. ;-)

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: GuilleVargas
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174264 by DenisChenu
Replied by DenisChenu on topic How Can I activate a Javascript Library ?
I do it with plugin on my part : gitlab.com/SondagesPro/ExportAndStats/pdfReport#documentation

but need a lot php script here. Less for javascript recording

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 following user(s) said Thank You: GuilleVargas
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174316 by tpartner
Replied by tpartner on topic How Can I activate a Javascript Library ?
Here is a custom question theme that includes the jQuery UI library. You can use it to see how to load a library and modify for your requirements.

github.com/tpartner/LimeSurvey-Card-Sorting-3.x

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu, LouisGac, f_funke, GuilleVargas
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose