- Posts: 6
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Add Color Picker in question type
- egroeg
- Topic Author
- Offline
- New Member
Less
More
4 years 3 weeks ago #196112
by egroeg
Add Color Picker in question type was created by egroeg
Hi all,
for a survey I'd like to add a color picker to a few questions, is there a way to do that?
I thought I could use the script field, but I can't find any hints on how to use it.
e.g. with this... <input type="color" id="favcolor" name="favcolor" value="#ff0000">
thanks for any help.
for a survey I'd like to add a color picker to a few questions, is there a way to do that?
I thought I could use the script field, but I can't find any hints on how to use it.
e.g. with this... <input type="color" id="favcolor" name="favcolor" value="#ff0000">
thanks for any help.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 3 weeks ago #196136
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 Add Color Picker in question type
What is the use-case? The <input type="color" /> element does not work in IE.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- egroeg
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
4 years 3 weeks ago #196210
by egroeg
Replied by egroeg on topic Add Color Picker in question type
In a survey we would like to get user feedback on a "prefered color".
I was hoping to be able to use a color picker and store the hex value as the answer. ( The top one here would be nice.)
But apparently I don't quite understand how to use the script field when setting up a question. No matter what I put in there, it always defaults to "javascript" and in any case nothing is shown when checking the question preview.
Obviously I am not a programmer. But I could also find no real explaination in the LimeSurvey docs on how to use that script editor.
thanks,
george
I was hoping to be able to use a color picker and store the hex value as the answer. ( The top one here would be nice.)
But apparently I don't quite understand how to use the script field when setting up a question. No matter what I put in there, it always defaults to "javascript" and in any case nothing is shown when checking the question preview.
Obviously I am not a programmer. But I could also find no real explaination in the LimeSurvey docs on how to use that script editor.
thanks,
george
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 3 weeks ago #196219
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 Add Color Picker in question type
I see no "top one" that is available for download.
I think if you want this to be compatible with all modern browsers, you will need to find and install a JavaScript plugin/library for the colour picker.
Regarding the editor, maybe you don't have the correct permissions to insert JavaScript.
- manual.limesurvey.org/Global_settings#Security
I think if you want this to be compatible with all modern browsers, you will need to find and install a JavaScript plugin/library for the colour picker.
Regarding the editor, maybe you don't have the correct permissions to insert JavaScript.
- manual.limesurvey.org/Global_settings#Security
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- egroeg
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
4 years 3 weeks ago #196235
by egroeg
Replied by egroeg on topic Add Color Picker in question type
hi tony,
sorry, was talking about the one highlighted below.
I get the HTML5 color picker (see img "Or use HTML5:") to show up in my question area. (last two images) but I don't have the slightest idea on how to get the "selected" color across into the text field.
well, but at least people can pick a color and punch in the RGB/hex values in regular numeric input fields. close enough.
thanks anyway. don't want to waste your time. this is obviously out of my league. :whistle:
cheers,
george
.
.
.
.
.
Color Pickers ( www.w3schools.com/colors/colors_picker.asp )
Question in source mode
Question preview
sorry, was talking about the one highlighted below.
I get the HTML5 color picker (see img "Or use HTML5:") to show up in my question area. (last two images) but I don't have the slightest idea on how to get the "selected" color across into the text field.
well, but at least people can pick a color and punch in the RGB/hex values in regular numeric input fields. close enough.
thanks anyway. don't want to waste your time. this is obviously out of my league. :whistle:
cheers,
george
.
.
.
.
.
Color Pickers ( www.w3schools.com/colors/colors_picker.asp )
Question in source mode
Question preview
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
4 years 3 weeks ago #196253
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 Add Color Picker in question type
With a short text question type
Try this in script part
Try this in script part
Code:
$("#answer{SGQ}").attr('type','color');
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.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 3 weeks ago - 4 years 3 weeks ago #196275
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 Add Color Picker in question type
That input type is buggy in IE (at least in my tests).
Additionally it looks like George doesn't have permissions to insert JS or inputs.
Additionally it looks like George doesn't have permissions to insert JS or inputs.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 3 weeks ago by tpartner.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
4 years 3 weeks ago - 4 years 3 weeks ago #196283
by DenisChenu
@egroeg
Can you test update question text in source mode and add this
And look again in source mode if you still have it
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 Add Color Picker in question type
Oh ... unsure : i check this mroning with github : seems broken ...tpartner wrote:
Additionally it looks like George doesn't have permissions to insert JS or inputs.
@egroeg
Can you test update question text in source mode and add this
Code:
<script> $(function() { $("#answer{SGQ}").attr('type','color'); alert("Xss seems disable"); }); </script>
And look again in source mode if you still have it
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.
Last edit: 4 years 3 weeks ago by DenisChenu.
The topic has been locked.
- egroeg
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
4 years 3 weeks ago #196287
by egroeg
Replied by egroeg on topic Add Color Picker in question type
great, that worked!! :woohoo:
i now have that simple color picker as an answer field.
still no idea, what you did there. know nothing about JS or jquery. am more of a lego-coding kind of guy. just playing around with bits and pieces of code, whithout knowing what i do, most of the time. sorry. x)
1.) from what i understand, this is using jquery? ( api.jquery.com/attr/#attr-attributeName-value )
couldn't find anything on the synthax used here:
could you possibly point me to a part of the manual?
2.) I guess it is kind of chaining attributes as I would do in Excel, right? just asking because i thought i could use TGO/LGO and "Long Text" as the input field, to get a larger color picker.
3.) also, the default color is black. how would i set a different value?
but again, this is already awesome. thanks for your help!
.
.
.
.
.
i now have that simple color picker as an answer field.
still no idea, what you did there. know nothing about JS or jquery. am more of a lego-coding kind of guy. just playing around with bits and pieces of code, whithout knowing what i do, most of the time. sorry. x)
1.) from what i understand, this is using jquery? ( api.jquery.com/attr/#attr-attributeName-value )
couldn't find anything on the synthax used here:
Code:
#answer{SGQ}
2.) I guess it is kind of chaining attributes as I would do in Excel, right? just asking because i thought i could use TGO/LGO and "Long Text" as the input field, to get a larger color picker.
3.) also, the default color is black. how would i set a different value?
but again, this is already awesome. thanks for your help!
.
.
.
.
.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 3 weeks ago #196293
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 Add Color Picker in question type
That will not work in Internet Explorer.i now have that simple color picker as an answer field.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
4 years 3 weeks ago #196305
by DenisChenu
And here : lack of em script (on('change'))
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 Add Color Picker in question type
I know, starting pointtpartner wrote:
That will not work in Internet Explorer.i now have that simple color picker as an answer field.
And here : lack of em script (on('change'))
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.