Browse Source

fix input autofill code

master
mortezaei 6 days ago
parent
commit
1c592e19d4
  1. 2
      src/components/Componentes/question-phone.tsx
  2. 56
      src/components/Componentes/question-text.tsx
  3. 22
      src/components/Componentes/question-textarea.tsx

2
src/components/Componentes/question-phone.tsx

@ -567,6 +567,7 @@ export function QuestionPhone({
].join(" ")}
>
<QuestionTitle question={question} />
<form autoComplete="off" onSubmit={(e) => e.preventDefault()}>
<div
dir="ltr"
data-snap-drag-ignore="true"
@ -645,6 +646,7 @@ export function QuestionPhone({
/>
</span>
</div>
</form>
{showInvalidState ? (
<span className="block group-10 font-semibold text-[#F2465F]">
Enter a valid phone number with country code.

56
src/components/Componentes/question-text.tsx

@ -92,18 +92,20 @@ export default function QuestionText({
)}
>
<QuestionTitle question={question} />
<Input
type="text"
inputMode="email"
dir="ltr"
name={`field_${question.id}`}
hasError={showInvalidState}
value={localValue}
onChange={(e) => handleChange(e.target.value)}
onBlur={handleBlur}
placeholder={question.extras.placeHolder}
disabled={disabled || isMuted}
/>
<form autoComplete="off" onSubmit={(e) => e.preventDefault()}>
<Input
type="text"
inputMode="email"
dir="ltr"
name={`field_${question.id}`}
hasError={showInvalidState}
value={localValue}
onChange={(e) => handleChange(e.target.value)}
onBlur={handleBlur}
placeholder={question.extras.placeHolder}
disabled={disabled || isMuted}
/>
</form>
{showInvalidState ? (
<span className="block group-10 font-semibold text-[#F2465F]">
{question.validation?.errorMessage ||
@ -131,20 +133,22 @@ export default function QuestionText({
)}
>
<QuestionTitle question={question} />
<Input
type={isNumericQuestion ? "tel" : "text"}
inputMode={isNumericQuestion ? "numeric" : "text"}
pattern={isNumericQuestion ? "[0-9]*" : undefined}
name={`field_${question.id}`}
value={localValue}
onChange={(e) => handleChange(e.target.value)}
onBlur={handleBlur}
placeholder={question.extras.placeHolder}
disabled={disabled || isMuted}
className={cn(
isMuted && "opacity-50 cursor-not-allowed bg-[#F5F5F5] border-[#E2E8F0]",
)}
/>
<form autoComplete="off" onSubmit={(e) => e.preventDefault()}>
<Input
type={isNumericQuestion ? "tel" : "text"}
inputMode={isNumericQuestion ? "numeric" : "text"}
pattern={isNumericQuestion ? "[0-9]*" : undefined}
name={`field_${question.id}`}
value={localValue}
onChange={(e) => handleChange(e.target.value)}
onBlur={handleBlur}
placeholder={question.extras.placeHolder}
disabled={disabled || isMuted}
className={cn(
isMuted && "opacity-50 cursor-not-allowed bg-[#F5F5F5] border-[#E2E8F0]",
)}
/>
</form>
{isMarjaQuestion ? (
<div className="mt-2.5 flex items-center">
<label className="flex cursor-pointer items-center gap-2 select-none active:scale-[0.99] transition-all">

22
src/components/Componentes/question-textarea.tsx

@ -64,16 +64,18 @@ export function QuestionTextarea({
)}
>
<QuestionTitle question={question} />
<Textarea
name={`field_${question.id}`}
value={localValue}
onChange={handleChange}
onBlur={handleBlur}
placeholder={question.extras.placeHolder}
disabled={disabled}
rows={5}
className="h-[270px]"
/>
<form autoComplete="off" onSubmit={(e) => e.preventDefault()}>
<Textarea
name={`field_${question.id}`}
value={localValue}
onChange={handleChange}
onBlur={handleBlur}
placeholder={question.extras.placeHolder}
disabled={disabled}
rows={5}
className="h-[270px]"
/>
</form>
{description ? (
<span className="block group-10 font-semibold text-[#747474]">
{description}

Loading…
Cancel
Save