Only check for postal code if we have a valid country
Otherwise, there we can not know the pattern to check against.
This commit is contained in:
parent
6e1d5b14bc
commit
ded10ded08
|
@ -256,7 +256,7 @@ func (f *bookingForm) Valid(ctx context.Context, conn *database.Conn, l *locale.
|
||||||
v.CheckMinLength(f.FullName, 1, l.GettextNoop("Full name must have at least one letter."))
|
v.CheckMinLength(f.FullName, 1, l.GettextNoop("Full name must have at least one letter."))
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.PostalCode.Val != "" {
|
if country != "" && f.PostalCode.Val != "" {
|
||||||
if _, err := v.CheckValidPostalCode(ctx, conn, f.PostalCode, country, l.GettextNoop("This postal code is not valid.")); err != nil {
|
if _, err := v.CheckValidPostalCode(ctx, conn, f.PostalCode, country, l.GettextNoop("This postal code is not valid.")); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue