mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-26 18:29:53 -06:00
fix: skip button label validation for required nps and rating questions (#5153)
This commit is contained in:
committed by
GitHub
parent
2867c95494
commit
6671d877ad
@@ -146,6 +146,10 @@ export const validationRules = {
|
||||
fieldsToValidate = fieldsToValidate.filter((field) => field !== "backButtonLabel");
|
||||
}
|
||||
|
||||
if ((question.type === "nps" || question.type === "rating") && question.required) {
|
||||
fieldsToValidate = fieldsToValidate.filter((field) => field !== "buttonLabel");
|
||||
}
|
||||
|
||||
for (const field of fieldsToValidate) {
|
||||
if (
|
||||
question[field] &&
|
||||
|
||||
@@ -943,11 +943,19 @@ export const ZSurvey = z
|
||||
"placeholder",
|
||||
];
|
||||
|
||||
const fieldsToValidate =
|
||||
let fieldsToValidate =
|
||||
questionIndex === 0 || isBackButtonHidden
|
||||
? initialFieldsToValidate
|
||||
: [...initialFieldsToValidate, "backButtonLabel"];
|
||||
|
||||
// Skip buttonLabel validation for required NPS and Rating questions
|
||||
if (
|
||||
(question.type === TSurveyQuestionTypeEnum.NPS || question.type === TSurveyQuestionTypeEnum.Rating) &&
|
||||
question.required
|
||||
) {
|
||||
fieldsToValidate = fieldsToValidate.filter((field) => field !== "buttonLabel");
|
||||
}
|
||||
|
||||
for (const field of fieldsToValidate) {
|
||||
// Skip label validation for consent questions as its called checkbox label
|
||||
if (field === "label" && question.type === TSurveyQuestionTypeEnum.Consent) {
|
||||
|
||||
Reference in New Issue
Block a user