View Issue Details

This issue affects 1 person(s).
 0
IDProjectCategoryView StatusLast Update
20635Bug reportsSurvey editingpublic2026-08-05 16:34
Reportergabrieljenik Assigned Togabrieljenik  
PrioritynoneSeveritypartial_block 
Status assignedResolutionopen 
Product Version7.0.x 
Summary20635: Replacement Fields Not Inserted Correctly in Templates with Multiple Editors
Description

While reviewing ticket 20607, an issue was identified related to the behavior of replacement fields in templates when multiple editors are present on the same page.

Background:

Before commit 5f84fe89c50, the first template where replacement fields were correctly displayed and inserted was the Confirmation template. In that context, everything worked as expected.

However, in subsequent templates (such as Registration or Basic Admin Notification), all replacement field options resulted in inserting {TOKEN} instead of the selected value.

After the mentioned commit, the issue appears to have shifted: Replacement fields now work correctly in Invitation and Reminder templates. The issue persists in other templates.

Technical Analysis:

The root cause appears to be within the CKEditor plugin limereplacementfields.

The plugin uses a <select> element with the ID cquestions to list replacement fields.
On selection, it retrieves the value using: $('#cquestions').val()

On pages with multiple editors, multiple elements share the same ID cquestions, which is invalid in HTML.
As a result, $('#cquestions').val() always returns the value of the first matching element in the DOM, leading to incorrect token insertion.

Suggested Fix:

Ensure that each replacement field selector has a unique identifier per editor instance, or scope the selector to the active editor context instead of using a global ID.

Impact:

This affects multiple templates where more than one editor is present, leading to incorrect token insertion and potential misconfiguration of email templates.

Notes:

The issue is not new but was previously limited to specific templates. Recent changes appear to have shifted where the issue manifests rather than resolving the underlying cause.

Steps To Reproduce

Expected Behavior:
Each editor should correctly retrieve and insert the selected replacement field corresponding to its own dropdown.

Actual Behavior:
When multiple editors are present, replacement field selection may insert incorrect or default values (e.g., {TOKEN}), due to ID conflicts.

TagsNo tags attached.
Bug heat0
Complete LimeSurvey version number (& build).
I will donate to the project if issue is resolvedNo
Story point estimate0
Browser
Database type & versionMysql
Server OS (if known)
Webserver software & version (if known)
PHP Version8.x

Relationships

related to 20607 ready for code reviewgabrieljenik Placeholder fields are empty in the Email Templates editor 

Users monitoring this issue

There are no users monitoring this issue.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2026-08-05 16:31 gabrieljenik New Issue
2026-08-05 16:31 gabrieljenik Relationship added related to 20607
2026-08-05 16:31 gabrieljenik Assigned To => gabrieljenik
2026-08-05 16:31 gabrieljenik Status new => assigned