Make FormValidator.CheckValidDate method public

This commit is contained in:
jordi fita mas 2023-02-12 21:01:20 +01:00
parent 5c15b9de20
commit c2d8006748
2 changed files with 2 additions and 2 deletions

View File

@ -270,7 +270,7 @@ func (form *contactForm) Validate(ctx context.Context, conn *Conn) bool {
validator.CheckValidEmailInput(form.Email, gettext("This value is not a valid email. It should be like name@domain.com.", form.locale))
}
if form.Web.Val != "" {
validator.checkValidURL(form.Web, gettext("This value is not a valid web address. It should be like https://domain.com/.", form.locale))
validator.CheckValidURL(form.Web, gettext("This value is not a valid web address. It should be like https://domain.com/.", form.locale))
}
validator.CheckRequiredInput(form.Address, gettext("Address can not be empty.", form.locale))
validator.CheckRequiredInput(form.City, gettext("City can not be empty.", form.locale))

View File

@ -180,7 +180,7 @@ func (v *FormValidator) CheckValidSelectOption(field *SelectField, message strin
return v.checkSelect(field, field.HasValidOptions(), message)
}
func (v *FormValidator) checkValidURL(field *InputField, message string) bool {
func (v *FormValidator) CheckValidURL(field *InputField, message string) bool {
_, err := url.ParseRequestURI(field.Val)
return v.checkInput(field, err == nil, message)
}