diff options
author | Jonas Smedegaard <dr@jones.dk> | 2024-03-28 15:41:38 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-03-28 15:41:38 +0100 |
commit | b1d158f333d37da682de6854cf80f83a6777fa80 (patch) | |
tree | 5315bea197e62dc7f74a4fe680cca531dc93d14d /kontakt.cgi | |
parent | 0a1aef1e7e502df51b9d85b6ac6428f255f58b41 (diff) |
validate fields postnr antal
Diffstat (limited to 'kontakt.cgi')
-rwxr-xr-x | kontakt.cgi | 5 |
1 files changed, 5 insertions, 0 deletions
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 |