Make sure that a hidden field/question is never required (#7652)
* Update required field value as per hidden field value * Translate Required and Optional * Translate Label and Placeholder
This commit is contained in:
1 parent
f22bf721f2
commit
7edebbcef0
2 files changed
+12
-8
No files matched your search
@@ -76,7 +76,8 @@ function preprocess<T extends z.ZodType>({
|
||||
: z.string().refine((val) => isValidPhoneNumber(val));
|
||||
// Tag the message with the input name so that the message can be shown at appropriate place
|
||||
const m = (message: string) => `{${bookingField.name}}${message}`;
|
||||
const isRequired = bookingField.required;
|
||||
// If the field is hidden, then it can never be required
|
||||
const isRequired = bookingField.hidden ? false : bookingField.required;
|
||||
if ((isPartialSchema || !isRequired) && value === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user