Welcome to the LimeSurvey Community Forum

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

Enable opt-out for single choice questions (dropdown) server validation

  • mpac_limes
  • mpac_limes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #184066 by mpac_limes
For single choice questions (dropdown), there is a new server-side validation that only accepts as valid what it was initially defined as an answer. That makes impossible to dynamically (via javascript) generate content for select controls. This has been really unconvenient for me.

Was it intentional and there is a strong reason to do so? Could it be possible to enable an opt-out control for this question type validation? That would be great, even if the validation is set to true by default. This way you could have the best of two worlds.

Thanks
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
5 years 6 months ago #184074 by DenisChenu

mpac_limes wrote: Was it intentional and there is a strong reason to do so?

Because if we don't filter : paerticpant can enter anything, and it's a really bad system … there still some effort to do (for example for array filter in choice).

mpac_limes wrote: Could it be possible to enable an opt-out control for this question type validation?

Not currently, but : you can ask for a new feature and make a pull request with updated code.

Else : you add the option before question view or after (user can enter anything) ?

If before question view : add the new answer code in www.limesurvey.org/manual/BeforeQuestionRender event
If after : 2 solution,
1. Add new answer code in a ajax event
2. Add a new answer code in www.limesurvey.org/manual/BeforeSurveyPage event (check POST value, if you're OK with POST value and need a new answer : create it) : this allow you to validate this value too.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • mpac_limes
  • mpac_limes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #184087 by mpac_limes

DenisChenu wrote:

mpac_limes wrote: Was it intentional and there is a strong reason to do so?

Because if we don't filter : paerticpant can enter anything, and it's a really bad system … there still some effort to do (for example for array filter in choice).

Well, in a text question, users can equally enter anything, and nothing bad happens. I imagine that answer codes not matching may be a concern, but I don't think my use case is so wild to fully disallow it without an alternative. Maybe questions marked as "not validated" could be treated like a free text value after the survey is submitted.

mpac_limes wrote: Could it be possible to enable an opt-out control for this question type validation?

Not currently, but : you can ask for a new feature and make a pull request with updated code.

Else : you add the option before question view or after (user can enter anything) ?

If before question view : add the new answer code in www.limesurvey.org/manual/BeforeQuestionRender event
If after : 2 solution,
1. Add new answer code in a ajax event
2. Add a new answer code in www.limesurvey.org/manual/BeforeSurveyPage event (check POST value, if you're OK with POST value and need a new answer : create it) : this allow you to validate this value too.


Javascript adds them after question view. Furthermore, it is something like a set cascading combos, so it is very dynamic. The options are loaded from an external source, so limesurvey will never be able to determine beforehand the set of correct answers.

So if I've understood well, my only options could be:

1) before the section submit, launch an ajax call that inserts the option as a valid answer option in answers table in the limesurvey BD

2) to make a plugin that would do the same than 1 but in the php

Nothing you would like to carry on your surveys :(
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
5 years 6 months ago #184092 by DenisChenu
Then : why not use a text input ?

For example : www.devbridge.com/sourcery/components/jquery-autocomplete/ us a text input not a dropdown.

And <input type="search"> is shown as a text, not as a dropdown. And search is clearly near an autocomplete system.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • mpac_limes
  • mpac_limes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #184155 by mpac_limes
I would rather give the users a dropdown. Having a look at selectable options may be of aid. Besides, if the question is open to type in whatever users want, we can get low quality input. If finally I use a text field I suppose that allowing only the generated answer options is doable with jquery autocomplete but it would need to be worked on.

Also, what happens with the IDs? I want to display question options as text but store the IDs in that field, not displaying selected ID at any time. If jQuery autocomplete supports it (I think it should and probably it does) that would be another custom configuration.

I agree that somehow you could get it working but the point is that something that former limesurvey versions allowed to do in a breeze, now needs a complex workaround.

I just expected newer versions to be easier to use than older ones, not the other way round. Sorry for my nitpicking, I guess LS developers have to make choices like that sometimes.

Thanks Denis
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
5 years 6 months ago #184157 by DenisChenu

mpac_limes wrote: I agree that somehow you could get it working but the point is that something that former limesurvey versions allowed to do in a breeze, now needs a complex workaround.

And former version allow public user to broke DB … don't find way to compromise DB, but …

Else : did you post a feature request ?
Else : i don't understand : you want to show a real dropdown but allowing adding element via js ? Then it can‘t be a realdropdown …
Else : all can be possible : even use devbridgeAutocomplete with fixed value and send only code (id of answer)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The following user(s) said Thank You: mpac_limes
The topic has been locked.
  • mpac_limes
  • mpac_limes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #184162 by mpac_limes
Should I post a feature request when it seems like I'm the only one that misses that feature?

I don't mind actually if it's a real dropdown or not. What I would like is that it behaves like a dropdown and that when creating a survey, I have this functionality out of the box and it is not needed to lose time putting the workaround in place.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
5 years 6 months ago #184172 by DenisChenu
Else
gitlab.com/SondagesPro/QuestionSettingsType/autoComplete#usage

autoCompleteAsDropdown: Disable javascript search system and show autocomplete as dropdown.


Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose