mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
fix: backButton and button target mixup
fix: backButton and button target mixup
This commit is contained in:
@@ -244,24 +244,9 @@ export default function QuestionCard({
|
||||
<Input
|
||||
id="buttonLabel"
|
||||
name="buttonLabel"
|
||||
className={cn(
|
||||
isInValid &&
|
||||
question.backButtonLabel?.trim() === "" &&
|
||||
"border border-red-600 focus:border-red-600"
|
||||
)}
|
||||
value={question.buttonLabel}
|
||||
placeholder={lastQuestion ? "Finish" : "Next"}
|
||||
onChange={(e) => {
|
||||
const trimmedValue = e.target.value.trim(); // Remove spaces from the start and end
|
||||
const hasInternalSpaces = /\S\s\S/.test(trimmedValue); // Test if there are spaces between words
|
||||
|
||||
if (
|
||||
!trimmedValue.includes(" ") &&
|
||||
(trimmedValue === "" || hasInternalSpaces || !/\s/.test(trimmedValue))
|
||||
) {
|
||||
updateQuestion(questionIdx, { backButtonLabel: trimmedValue });
|
||||
}
|
||||
}}
|
||||
onChange={(e) => updateQuestion(questionIdx, { buttonLabel: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -269,11 +254,6 @@ export default function QuestionCard({
|
||||
<BackButtonInput
|
||||
value={question.backButtonLabel}
|
||||
onChange={(e) => updateQuestion(questionIdx, { backButtonLabel: e.target.value })}
|
||||
className={cn(
|
||||
isInValid &&
|
||||
question.backButtonLabel?.trim() === "" &&
|
||||
"border border-red-600 focus:border-red-600"
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
@@ -284,11 +264,6 @@ export default function QuestionCard({
|
||||
<BackButtonInput
|
||||
value={question.backButtonLabel}
|
||||
onChange={(e) => updateQuestion(questionIdx, { backButtonLabel: e.target.value })}
|
||||
className={cn(
|
||||
isInValid &&
|
||||
question.backButtonLabel?.trim() === "" &&
|
||||
"border border-red-600 focus:border-red-600"
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -18,11 +18,7 @@ const validationRules = {
|
||||
return question.label.trim() !== "";
|
||||
},
|
||||
defaultValidation: (question: TSurveyQuestion) => {
|
||||
return (
|
||||
question.headline.trim() !== "" &&
|
||||
question.buttonLabel?.trim() !== "" &&
|
||||
question.backButtonLabel?.trim() !== ""
|
||||
);
|
||||
return question.headline.trim() !== "";
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user