Select menu option value of modal returns 'undefined'
Modal component
Interaction handling
Result
So why is value 'undefined'?
const modal = new Modal()
.setTitle('Warning')
.setCustomId('warn-modal')
const select = new MessageSelectMenu()
.setCustomId('reason-select')
.setPlaceholder('Select')
.addOptions([
{ label: 'Rule 1 - harmful post/username/profile etc..', value: '1' },
{ label: 'Rule 2 - spamming and flooding', value: '2' },
{ label: 'Rule 3 - self promotion and unsolicited DMs', value: '3' },
{ label: 'Rule 4 - advertising discord servers and paid services', value: '4' },
{ label: 'Rule 5 - sub4sub type behaviour', value: '5' },
{ label: 'Rule 6 - openly discussing moderator actions', value: '6' },
{ label: 'Rule 7 - messages not in English', value: '7' },
{ label: 'Custom', value: 'Custom' }
])
const row = new MessageActionRow().addComponents([select]);
modal.addComponents(row);
await interaction.showModal(modal);
const modal = new Modal()
.setTitle('Warning')
.setCustomId('warn-modal')
const select = new MessageSelectMenu()
.setCustomId('reason-select')
.setPlaceholder('Select')
.addOptions([
{ label: 'Rule 1 - harmful post/username/profile etc..', value: '1' },
{ label: 'Rule 2 - spamming and flooding', value: '2' },
{ label: 'Rule 3 - self promotion and unsolicited DMs', value: '3' },
{ label: 'Rule 4 - advertising discord servers and paid services', value: '4' },
{ label: 'Rule 5 - sub4sub type behaviour', value: '5' },
{ label: 'Rule 6 - openly discussing moderator actions', value: '6' },
{ label: 'Rule 7 - messages not in English', value: '7' },
{ label: 'Custom', value: 'Custom' }
])
const row = new MessageActionRow().addComponents([select]);
modal.addComponents(row);
await interaction.showModal(modal);
console.log(interaction.fields.getField('reason-select'))
console.log(interaction.fields.getField('reason-select'))
{ value: undefined, type: 'SELECT_MENU', customId: 'reason-select' }
{ value: undefined, type: 'SELECT_MENU', customId: 'reason-select' }
1 Reply
So.. Just to clarify. Select menus are not supported in modals? 😄