-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation between fields #15
Comments
Hi. I have only implemented validation per field, although I think I should also have implemented per whole form, so that validation between fields can be achieved. I think in this case you will have to provide validation for the form yourself. |
To add your own validation message follow |
Ah ok I thought that maybe there was a way to actually include validation among multiple fields. For now I have implemented it using a function that verifies the whole form and either returns nil if everything's cool or the form with the errors if there are problems: (defun register-form-errors (form)
(if (forms::validate-form form)
(forms::with-form-field-values (username password password-verify) form
(cond ((not (equal password password-verify))
(forms:add-form-error 'password-verify "Passwords do not match" form))
((equal username "root")
(forms:add-form-error 'username "Wrong username" form))
(t nil)))
form)) To implement the validation among fields you could add an optional parameter with that function in the form definition, for example:
|
Also we could add a generic |
Ah. I forgot about |
I want to implement a form similar to this:
The fields
password
andpassword-verify
must match. Is there a way to validate these(forms::validate-form form)
? If not how can I add the extra validation messages for these?TIA
The text was updated successfully, but these errors were encountered: