mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-15 10:08:41 -06:00
Feature : Toggle Multi-Select and Single-Select Question Types
Feature : Toggle Multi-Select and Single-Select Question Types
This commit is contained in:
@@ -223,6 +223,15 @@ export default function MultipleChoiceMultiForm({
|
||||
Add "Other"
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
size="sm"
|
||||
variant="minimal"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
updateQuestion(questionIdx, { type: "multipleChoiceSingle" });
|
||||
}}>
|
||||
Convert to Single Select
|
||||
</Button>
|
||||
|
||||
<div className="flex flex-1 items-center justify-end gap-2">
|
||||
<Select
|
||||
|
||||
@@ -223,6 +223,15 @@ export default function MultipleChoiceSingleForm({
|
||||
Add "Other"
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
size="sm"
|
||||
variant="minimal"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
updateQuestion(questionIdx, { type: "multipleChoiceMulti" });
|
||||
}}>
|
||||
Convert to Multi Select
|
||||
</Button>
|
||||
|
||||
<div className="flex flex-1 items-center justify-end gap-2">
|
||||
<Select
|
||||
|
||||
@@ -39,7 +39,8 @@ export default function MultipleChoiceMultiQuestion({
|
||||
.map((choice) => choice.label);
|
||||
|
||||
useEffect(() => {
|
||||
const nonOtherSavedChoices = storedResponseValue?.filter((answer) =>
|
||||
if(Array.isArray(storedResponseValue)){
|
||||
const nonOtherSavedChoices = storedResponseValue?.filter((answer) =>
|
||||
nonOtherChoiceLabels.includes(answer)
|
||||
);
|
||||
const savedOtherSpecified = storedResponseValue?.find((answer) => !nonOtherChoiceLabels.includes(answer));
|
||||
@@ -50,6 +51,7 @@ export default function MultipleChoiceMultiQuestion({
|
||||
setOtherSpecified(savedOtherSpecified);
|
||||
setShowOther(true);
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [storedResponseValue, question.id]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user