From b1d158f333d37da682de6854cf80f83a6777fa80 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 28 Mar 2024 15:41:38 +0100 Subject: validate fields postnr antal --- kontakt.cgi | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'kontakt.cgi') diff --git a/kontakt.cgi b/kontakt.cgi index a860a9d..cfe9a08 100755 --- a/kontakt.cgi +++ b/kontakt.cgi @@ -22,6 +22,8 @@ my ($confirm) = 1; # Built-in email validation is too simplistic my $valid_email = '/^[+_A-Za-z0-9-]+(\.[+_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[_A-Za-z0-9-]+)$/'; +my $valid_dk_zip = '/^([Dd][Kk])?.?[0-9-]{4}$/'; + my $form = CGI::FormBuilder->new( lang => 'da', title => 'Henvendelse til Byvandring.nu', @@ -37,8 +39,11 @@ my $form = CGI::FormBuilder->new( kommentar /], validate => { + postnr => $valid_zip_dk, + _postnr => $valid_zip_dk, #fake check to silence warning of variable used only once email => $valid_email, _email => $valid_email, #fake check to silence warning of variable used only once + antal => 'INT', }, required => [qw/ email -- cgit v1.2.3