Skip to content

Conversation

@nicobytes
Copy link
Contributor

@nicobytes nicobytes commented Jan 16, 2026

This pull request updates the way DOM elements are selected in the edit_field.jsp file, replacing the use of the $() selector (which is likely a jQuery-style or custom selector) with the native JavaScript document.getElementById method. This change improves code clarity and performance by relying on standard, modern JavaScript APIs.

Refactoring DOM element selection:

  • Replaced $() selector with document.getElementById for updating the image thumbnail source in the change<%=field.getFieldContentlet()%>ThumbnailSize function.
  • Updated the update<%=field.getVelocityVarName()%>MultiSelect function to use document.getElementById instead of $() for accessing the multi-select element and its hidden field. [1] [2]
  • Changed the code that updates the value of the checkbox hidden field to use document.getElementById instead of $().

This PR fixes: #34288

This PR fixes: #34288

…o-persist-when-jquery-is-included-via-custom-field-vtl
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request partially addresses issue #34288 by replacing jQuery-conflicting $() selectors with standard document.getElementById() calls in field update functions. The issue occurs when external jQuery is loaded via a Custom Field VTL script, overriding the legacy $() shorthand function and breaking field persistence for checkboxes and date fields.

Changes:

  • Replaced $() with document.getElementById() in checkbox, multi-select, and image thumbnail update functions

…hen-jquery-is-included-via-custom-field-vtl' of github.com:dotCMS/core into 34288-defect-checkbox-and-date-fields-fail-to-persist-when-jquery-is-included-via-custom-field-vtl
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@nicobytes nicobytes added this pull request to the merge queue Jan 16, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 16, 2026
@nicobytes nicobytes added this pull request to the merge queue Jan 16, 2026
Merged via the queue into main with commit 625a921 Jan 16, 2026
44 checks passed
@nicobytes nicobytes deleted the 34288-defect-checkbox-and-date-fields-fail-to-persist-when-jquery-is-included-via-custom-field-vtl branch January 16, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[DEFECT] Checkbox and Date fields fail to persist when jQuery is included via Custom Field (VTL)

6 participants