Skip to content

FORMS-25008 add multiselect support for DropDown component#171

Merged
gaurav5826 merged 2 commits into
adobe:mainfrom
gaurav5826:FORMS-25008
Apr 16, 2026
Merged

FORMS-25008 add multiselect support for DropDown component#171
gaurav5826 merged 2 commits into
adobe:mainfrom
gaurav5826:FORMS-25008

Conversation

@gaurav5826

@gaurav5826 gaurav5826 commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Added multiple attribute to the <select> element in DropDown.tsx when isMultiSelect is true
  • Change handler now collects all selected option values as a string[] for multiselect dropdowns, dispatching an array instead of a single value
  • withRuleEngine.tsx derives isMultiSelect from state.type === 'string[]'
  • Added isMultiSelect?: boolean to the PROPS type in type.tsx
  • isFilled check updated to handle array values correctly for CSS class toggling

JIRA

FORMS-25008

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gaurav5826 gaurav5826 marked this pull request as ready for review April 16, 2026 05:24
@gaurav5826 gaurav5826 requested a review from amit-mnnit April 16, 2026 05:24
visible: state.label?.visible !== false
},
isError: getValidationState(state) === 'invalid',
isMultiSelect: state.type === 'string[]',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It can be a number, boolean, or any other type. Don’t hardcode it as a string—just check whether the value contains '[]' or not.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. Changed to state.type?.includes('[]') so any array type (number[], boolean[], etc.) is correctly detected as multi-select, not just string[].

const dropValue = enumNames && enumNames.length ? enumNames : enums || [];
let selectedValue = value ?? '';
const selectedValue = isMultiSelect
? (Array.isArray(value) ? (value as any[]).map(String) : (value !== null && value !== undefined ? [String(value)] : []))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Don’t hardcode it as a string

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. Removed the String() coercions so values are passed in their original type. The as any[] cast was also removed since it was only needed to call .map().

@amit-mnnit amit-mnnit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please check the comments

@gaurav5826 gaurav5826 merged commit e246bae into adobe:main Apr 16, 2026
3 of 4 checks passed
@armaang1729

Copy link
Copy Markdown
Collaborator

For this change there was already a PR raised #167

@armaang1729 armaang1729 mentioned this pull request Apr 20, 2026
10 tasks
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.

3 participants