Make answers to volume questions optional

It’s annoying and very ‘computer says no’ to make people type `0` in a
box. We can see from our analytics that this error is affecting about 7%
of users trying to go live.

This commit relaxes the validation to only require a number greater than
1 for at least one of the questions.

It also lets people enter their numbers comma-separated – like our
examples suggest – but normalises them to integers before sending them
over to the API.
This commit is contained in:
Chris Hill-Scott
2019-02-15 13:34:29 +00:00
parent 8791134c60
commit 9f63449384
3 changed files with 105 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
{% extends "withnav_template.html" %}
{% from "components/banner.html" import banner_wrapper %}
{% from "components/form.html" import form_wrapper %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/radios.html" import radios %}
@@ -11,8 +12,17 @@
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-whole">
{% call form_wrapper() %}
{% if not form.at_least_one_volume_filled %}
{% call banner_wrapper(type='dangerous') %}
<h1 class='banner-title'>
no things supplied
</h1>
<p>Tell us some things</p>
{% endcall %}
{% else %}
<h1 class="heading-large">Estimate usage</h1>
{% endif %}
{% call form_wrapper() %}
<div class="form-group">
{{ textbox(form.volume_email, width='1-2', hint='For example, 1,000,000') }}
{{ textbox(form.volume_sms, width='1-2', hint='For example, 500,000') }}