Validation playground
One form, five packages. Every field is optional except the identifier kind and the captcha, so you can try one
rule at a time. Rules run through the framework's #[validate(..)] attributes; failures come back
as ordinary field errors.
Results
Submit the form to see the formatted values and the sanitized HTML.
The input struct
#[laravel::input]
pub struct Playground {
#[validate(Iban::new())] iban: Option<String>,
#[validate(Bic)] bic: Option<String>,
#[validate(VatNumberRule::checksum())] vat_number: Option<String>,
#[validate(required, NationalIdKind)] id_kind: String,
#[validate(NationalIdOfKind)] national_id: Option<String>,
#[serde(rename = "cf-turnstile-response")]
#[validate(Captcha::new())] captcha: Option<String>,
}
// VatNumberRule::online() is added in ValidatesRequest::rules when "vies" is ticked.
Image captcha
laravel-captcha 0.3 also draws its own captcha, the counterpart of mews/captcha: nothing leaves the
server and no account is needed. The answer lives in the session as a salted digest, expires after a minute and
can be tried once, so a wrong answer needs a new image.