View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
15876Feature requestsPluginspublic2020-02-19 15:57
ReporterDenisChenu Assigned To 
PrioritynoneSeverityfeature 
Status newResolutionopen 
Summary15876: afterValidateQuestion event to allow error or relevance by plugins
Description

function _ValidateQuestion can be really interesting to extend.

Additional Information
  1. _ValidateQuestion is used by _ValidateGroup and _ValidateSurvey : then no need to extend the 2 other _validate
  2. _ValidateQuestion allow to set default value OR to set relevance or to set hidden or to set valid/invalid (then disable move next or submit survey)
  3. It return qStatus : some index in this array can be updatable

My idea was :

  1. Add the event ValidateQuestion after qStatus is set https://github.com/LimeSurvey/LimeSurvey/blob/03840d3441aa0eb6d2d2bf83d754b591798a6803/application/helpers/expressions/em_manager_helper.php#L7183
  2. Send to the event : surveyid, qid, qtstaus + relevant + hidden + validTip + validJS + mandTip + updatedValues
  3. Allow to uodate in plugins : relevant + hidden + validTip + validJS + mandTip + updatedValues
TagsNo tags attached.
Bug heat4
Story point estimate
Users affected %

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2020-02-14 07:25

developer   ~55993

@ollehar : can be accepted without a plugin and a test ?

I think it's needed for plugin since some year ... for specific validation (for example validate a question via an API)

I can use it in place of 15873: setVariableExpressionEnd have lack of system to udate question part

ollehar

ollehar

2020-02-14 11:03

administrator   ~56004

Use-case?

DenisChenu

DenisChenu

2020-02-14 11:20

developer   ~56009

Oups ... sorry

  1. Fill value (if null) by an external API ($updatedValues)
  2. Set hidden for organizeSurvey
  3. Control validity by a complex method (call API for example) and set valid tue/false (i din't add it, but needed).

Maybe : create an event here : https://github.com/LimeSurvey/LimeSurvey/blob/03840d3441aa0eb6d2d2bf83d754b591798a6803/application/helpers/expressions/em_manager_helper.php#L6278
And allow update partially $qInfo ?

DenisChenu

DenisChenu

2020-02-14 11:22

developer   ~56010

My idea is allowing plugin to update some core part :

hidden,
relevance,
validity,
Subquestion relevance

etc ...

Maybe fix 15873: setVariableExpressionEnd have lack of system to udate question part is better ?

DenisChenu

DenisChenu

2020-02-14 11:23

developer   ~56011

PS:

_ValidateQuestion allow to set default value OR to set relevance or to set hidden or to set valid/invalid (then disable move next or submit survey)

:)

DenisChenu

DenisChenu

2020-02-19 15:57

developer   ~56098

OK :

allowing plugin to update some core part

See setVariableExpressionEnd (and fix)

Control validity by a complex method (call API for example)

Think it can be done with Expression manager function. samplemyApiCheckvalidity(self.NAOK)

There are no way to set hidden/relevance/etc ... more dinamically (must be in setVariableExpressionEnd)

Issue History

Date Modified Username Field Change
2020-02-14 07:23 DenisChenu New Issue
2020-02-14 07:25 DenisChenu Note Added: 55993
2020-02-14 11:03 ollehar Note Added: 56004
2020-02-14 11:20 DenisChenu Note Added: 56009
2020-02-14 11:22 DenisChenu Note Added: 56010
2020-02-14 11:23 DenisChenu Note Added: 56011
2020-02-19 15:57 DenisChenu Note Added: 56098