Skip to content

fix(pat-select2): Show predefined value for single-select widgets.#1600

Merged
petschki merged 3 commits into
masterfrom
thet/select2/single-select
Jun 9, 2026
Merged

fix(pat-select2): Show predefined value for single-select widgets.#1600
petschki merged 3 commits into
masterfrom
thet/select2/single-select

Conversation

@thet

@thet thet commented Jun 8, 2026

Copy link
Copy Markdown
Member

Single-select widgets did not show their predefined value. This is now fixed.

fixed:

image

not fixed:

image
  • I signed and returned the Plone Contributor Agreement, and received and accepted an invitation to join a team in the Plone GitHub organization.
  • I verified there aren't any other open pull requests for the same change.
  • I followed the guidelines in Contributing to Plone.
  • I successfully ran code quality checks on my changes locally.
  • I successfully ran tests on my changes locally.
  • If needed, I added new tests for my changes.
  • If needed, I added documentation for my changes.
  • I included a change log entry in my commits.

If your pull request closes an open issue, include the exact text below, immediately followed by the issue number. When your pull request gets merged, then that issue will close automatically.

Closes #

@thet thet requested review from MrTango and petschki June 8, 2026 00:12

it("renders the preset value of a single-select vocabulary widget", async function () {
document.body.innerHTML = `
<input class="pat-select2"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't that be a <select> if its not multiple values ?

I wonder why this is needed, because the language field actually works with predefined values: https://github.com/plone/plone.app.dexterity/blob/master/src/plone/app/dexterity/behaviors/metadata.py#L110

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A‌ <select> field cannot use AJAX‌ remote data.

And for the timezone selection fields I do not want to use pre-populated list of options - because it can be huge - but a text field where you can enter manually (if JS is off) or search/select via AJAX.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that makes totally sense

@petschki

petschki commented Jun 8, 2026

Copy link
Copy Markdown
Member

/run-coredev-robottests

@thet thet force-pushed the thet/select2/single-select branch 3 times, most recently from a83a2db to f885891 Compare June 8, 2026 15:42
@thet

thet commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

/run-coredev-robottests

@thet thet requested a review from petschki June 8, 2026 16:44
@thet

thet commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@petschki

Btw. I have added a test showing that the <select> field isn't broken with this PR.
But thanks for the fixes in the querystringwidget!

@petschki petschki force-pushed the thet/select2/single-select branch from f885891 to a4b35d6 Compare June 9, 2026 05:29

@petschki petschki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@petschki petschki merged commit 8d9abde into master Jun 9, 2026
3 checks passed
@petschki petschki deleted the thet/select2/single-select branch June 9, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants