Skip to content

Conversation

@licanhua
Copy link
Contributor

@licanhua licanhua commented Oct 6, 2021

Fix #6514

Because https://stackoverflow.com/questions/29882361/show-datalist-labels-but-submit-the-actual-value, the value is displayed when option is selected.
.value is not user friendly to user, so use .title to workaround the problem.
In the input, .title is used, then in value(), look up the datalist and return the actual option.value

known issue about this issue: wrong .value may be returned if two .title items are the same in the choice set. so we don't support duplicated .title in choiceset with filter

Before:
image

image

After:
image

image

			"items": [
				{
					"type": "Input.ChoiceSet",
					"choices": [
						{
							"title": "Apple Cider",
							"value": "1"
						},
						{
							"title": "Grape Juice",
							"value": "2"
						},
						{
							"title": "Banana Smoothie",
							"value": "3"
						},
						{
							"title": "Orange Juice",
							"value": "4"
						}
					],
					"placeholder": "Type Some To Expand",
					"style": "filtered",
					"label": "1.5 Filtered Style",
					"id": "2"
				},
Microsoft Reviewers: Open in CodeFlow

@ghost
Copy link

ghost commented Oct 6, 2021

Hi @licanhua. Thanks for helping make the AdaptiveCards JS renderer + tooling better. As additional verification, once the JS build succeeds, please go to the test site to test out your website/designer changes.

Copy link
Contributor

@almedina-ms almedina-ms left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Contributor

@RebeccaAnne RebeccaAnne left a comment

Choose a reason for hiding this comment

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

:shipit:

@licanhua licanhua enabled auto-merge (squash) October 7, 2021 16:55
@licanhua licanhua merged commit 8271e9d into main Oct 7, 2021
@licanhua licanhua deleted the canhua/fixtitle branch October 7, 2021 19:28
michaelfarnsworth pushed a commit to michaelfarnsworth/AdaptiveCards that referenced this pull request Nov 10, 2022
Co-authored-by: RebeccaAnne <rebecch@microsoft.com>
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.

[JavaScript] JS renderer replaces the title with the value of the filtered style Input.ChoiceSet when the choice is made.

5 participants