diff options
author | Struan Donald <struan@exo.org.uk> | 2014-04-09 17:09:14 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2014-04-15 15:53:18 +0100 |
commit | 565c6498aefea0fd39ec7453019bbf86b52672dd (patch) | |
tree | fa11d5c90de95202da33086a56285b6a348aee88 /perllib/FixMyStreet/Cobrand/FixMyStreet.pm | |
parent | b82228ce014cc87866d976eeb3ce6e454e87c336 (diff) |
Add a who are you trying to contact option to contact form
In order to try and cut down on people mistakingly using this form to
try and contact their council all some 'who are you trying to contact'
options to the form that display appropriate messaged unless the 'FMS
team option is selected.
Add the validation code for this in the cobrand module.
Fixes #41
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/FixMyStreet.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyStreet.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index c3a1f9d9d..ce62e206e 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -21,5 +21,23 @@ sub title_list { return undef; } +sub extra_contact_validation { + my $self = shift; + my $c = shift; + + my %errors; + + $c->stash->{dest} = $c->req->param('dest'); + + $errors{dest} = "Please enter who your message is for" + unless $c->req->param('dest'); + + if ( $c->req->param('dest') eq 'council' || $c->req->param('dest') eq 'update' ) { + $errors{not_for_us} = 1; + } + + return %errors; +} + 1; |