Skip to content

Commit 63d608a

Browse files
Fix input type error
1 parent 87d9b4a commit 63d608a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/QuizExamFormUF.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useForm, useFieldArray, Controller } from "react-hook-form";
44
import { Button } from "./Button";
55
import useResults from "@azure-fundamentals/hooks/useResults";
66
import { Question, Option } from "@azure-fundamentals/components/types";
7+
import { valueFromAST } from "graphql";
78

89
type Props = {
910
isLoading: boolean;
@@ -224,11 +225,12 @@ const QuizExamForm: FC<Props> = ({
224225
render={({ field }) => (
225226
<input
226227
{...field}
227-
type="checkbox"
228+
type={noOfAnswers > 1 ? "checkbox" : "radio"}
228229
id={`options.${currentQuestionIndex}.${index}`}
229230
className={`peer hidden [&:checked_+_label_svg_path]:block `}
230231
disabled={showCorrectAnswer}
231232
checked={field.value}
233+
value={field.name}
232234
onChange={(e) => {
233235
if (noOfAnswers === 1) {
234236
fields.forEach((_, idx) => {

0 commit comments

Comments
 (0)