View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
19392Bug reportsQuestion editorpublic2024-02-19 16:17
Reporterc_schmitz Assigned ToDenisChenu  
PriorityhighSeverityminor 
Status closedResolutionfixed 
Product Version6.4.x 
Summary19392: Missing frontend validation on subquestion codes
Description

When entering an invalid code for a subquestion and saving, an undefined JS error happens, and the subquestion is not saved.

Steps To Reproduce

Steps to reproduce

Create a question of any type that uses subquestions.
Change the code of the 1st subquestion to 'äabr'
Save.

Expected result

Before being able to save an error message should show (like on normal question codes' that says 'Question codes must start with a letter and may only contain alphanumeric characters.'

Actual result

Undefifend JSON ajax error.

TagsNo tags attached.
Bug heat10
Complete LimeSurvey version number (& build)6.x
I will donate to the project if issue is resolvedNo
Browser
Database type & versionn/a
Server OS (if known)
Webserver software & version (if known)
PHP Versionn/a

Relationships

related to 19401 new underscore is allowed in subquestion code 

Users monitoring this issue

DenisChenu

Activities

c_schmitz

c_schmitz

2024-02-02 17:37

administrator   ~79400

Last edited: 2024-02-02 23:33

Technical info:

Add frontent validation.

If front end validation fails then in

application\models\services\QuestionAggregateService\SubQuestionsService.php

the exception here:

    if (!$subquestion->save()) {
        throw new PersistErrorException('Could not save subquestion');
    }

should also give back getErrors() from the model.
That should also be handed back in the ajax reply.

tibor.pacalat

tibor.pacalat

2024-02-05 11:06

administrator   ~79408

@DenisChenu @gabrieljenik who can take this one?

DenisChenu

DenisChenu

2024-02-08 16:31

developer   ~79435

Partial fix : https://github.com/LimeSurvey/LimeSurvey/pull/3729

As long as I don't understand the purpose of the services and what they're supposed to return: I touch them as little as possible.

c_schmitz

c_schmitz

2024-02-15 14:31

administrator   ~79512

Yeah, I will take this for now.
There seems to be the same problem with answer options

DenisChenu

DenisChenu

2024-02-15 14:32

developer   ~79513

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=36068

DenisChenu

DenisChenu

2024-02-15 14:32

developer   ~79514

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=36067

DenisChenu

DenisChenu

2024-02-15 14:42

developer   ~79516

Yeah, I will take this for now.

My current issue is more on application\models\services\QuestionAggregateService\SubQuestionsService.php

And the first question is Why there are no translation of error ? What purpose ?

The fix is different :

  1. use SubQuestionsService with try/catch
  2. in SubQuestionsService add a getLastErrorForDisplay
  3. In cacth use getLastErrorForDisplay

or : remove usage of SubQuestionsService and use model directcly …

There seems to be the same problem with answer options

Can be done with html attribute : i can do it.

c_schmitz

c_schmitz

2024-02-15 14:46

administrator   ~79517

Already did it: https://github.com/LimeSurvey/LimeSurvey/commit/bccddcfc05cd4e852522ae7eed342ab241e514a5 - all good ;)

LimeBot

LimeBot

2024-02-19 16:17

administrator   ~79544

Fixed in Release 6.4.7+240219

Related Changesets

LimeSurvey: master c189adfb

2024-02-15 14:29:58

DenisChenu


Committer: GitHub Details Diff
Fixed issue 19392: Partial missing frontend validation on subquestion codes (03729) Affected Issues
19392
mod - application/views/questionAdministration/subquestionRow.twig Diff File
mod - assets/scripts/admin/questionEditor.js Diff File

LimeSurvey: master c189adfb

2024-02-15 14:29:58

DenisChenu


Committer: GitHub Details Diff
Fixed issue 19392: Partial missing frontend validation on subquestion codes (03729) Affected Issues
19392
mod - application/views/questionAdministration/subquestionRow.twig Diff File
mod - assets/scripts/admin/questionEditor.js Diff File

Issue History

Date Modified Username Field Change
2024-02-02 17:35 c_schmitz New Issue
2024-02-02 17:37 c_schmitz Note Added: 79400
2024-02-02 17:37 c_schmitz Bug heat 0 => 2
2024-02-02 17:37 c_schmitz Priority none => high
2024-02-02 18:01 DenisChenu Issue Monitored: DenisChenu
2024-02-02 18:01 DenisChenu Bug heat 2 => 4
2024-02-02 23:33 c_schmitz Note Edited: 79400
2024-02-05 11:06 tibor.pacalat Note Added: 79408
2024-02-05 11:06 tibor.pacalat Bug heat 4 => 6
2024-02-08 16:08 DenisChenu Relationship added related to 19401
2024-02-08 16:31 DenisChenu Note Added: 79435
2024-02-08 16:31 DenisChenu Bug heat 6 => 8
2024-02-15 14:31 c_schmitz Assigned To => c_schmitz
2024-02-15 14:31 c_schmitz Status new => resolved
2024-02-15 14:31 c_schmitz Resolution open => fixed
2024-02-15 14:31 c_schmitz Note Added: 79512
2024-02-15 14:32 DenisChenu Changeset attached => LimeSurvey master c189adfb
2024-02-15 14:32 DenisChenu Changeset attached => LimeSurvey master c189adfb
2024-02-15 14:32 DenisChenu Note Added: 79513
2024-02-15 14:32 DenisChenu Note Added: 79514
2024-02-15 14:32 DenisChenu Assigned To c_schmitz => DenisChenu
2024-02-15 14:32 DenisChenu Assigned To c_schmitz => DenisChenu
2024-02-15 14:42 DenisChenu Note Added: 79516
2024-02-15 14:46 c_schmitz Note Added: 79517
2024-02-19 16:17 LimeBot Note Added: 79544
2024-02-19 16:17 LimeBot Status resolved => closed
2024-02-19 16:17 LimeBot Bug heat 8 => 10