From a289e7f714e5e530d3496af24899b153403da279 Mon Sep 17 00:00:00 2001 From: Antoine Goutenoir Date: Fri, 2 Oct 2020 06:42:00 +0200 Subject: [PATCH] fix: another horrible bug --- flaskr/templates/estimation-request.html | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/flaskr/templates/estimation-request.html b/flaskr/templates/estimation-request.html index 3284e4e..8812a37 100644 --- a/flaskr/templates/estimation-request.html +++ b/flaskr/templates/estimation-request.html @@ -221,7 +221,7 @@ $(function() { var isHell = navigator.platform.match(/(iPhone|iP[ao]d|Mac|Pike)/i); if (isHell) { - var style = $('') + var style = $(''); $('html > head').append(style); $('textarea[placeholder]').each(function (index) { @@ -236,23 +236,36 @@ $(function() { $(this).val(text); }); - $('textarea[data-placeholder]').on('focus', function () { - if ($(this).attr('data-placeholder') === $(this).val()) { - $(this).attr('data-placeholder', $(this).val()); - $(this).val(''); - $(this).removeClass('active'); - } - }); - - $('textarea[data-placeholder]').on('blur', function () { - if ($(this).val() === '') { - var text = $(this).attr('data-placeholder'); - $(this).val(text); - $(this).addClass('active'); - } - }); + $('textarea[data-placeholder]') + .on('focus', function () { + if ($(this).attr('data-placeholder') === $(this).val()) { + $(this).attr('data-placeholder', $(this).val()); + $(this).val(''); + $(this).removeClass('active'); + } + }) + .on('blur', function () { + if ($(this).val() === '') { + $(this).val($(this).attr('data-placeholder')); + $(this).addClass('active'); + } + }) + ; } }); + +// Make sure the lists of cities are not required if we set files instead. +$(() => { + $("#origin_addresses_file").change(() => { + $("#origin_addresses").attr('required', null); + }); + $("#destination_addresses_file").change(() => { + $("#destination_addresses").attr('required', null); + }); +}); + + + {% endblock %} -- libgit2 0.21.2