Commit a289e7f714e5e530d3496af24899b153403da279
1 parent
a7e8b345
Exists in
master
fix: another horrible bug
Showing
1 changed file
with
29 additions
and
16 deletions
Show diff stats
flaskr/templates/estimation-request.html
... | ... | @@ -221,7 +221,7 @@ $(function() { |
221 | 221 | var isHell = navigator.platform.match(/(iPhone|iP[ao]d|Mac|Pike)/i); |
222 | 222 | |
223 | 223 | if (isHell) { |
224 | - var style = $('<style>textarea[data-placeholder].active { color: #666; }</style>') | |
224 | + var style = $('<style>textarea[data-placeholder].active { color: #666; }</style>'); | |
225 | 225 | $('html > head').append(style); |
226 | 226 | |
227 | 227 | $('textarea[placeholder]').each(function (index) { |
... | ... | @@ -236,23 +236,36 @@ $(function() { |
236 | 236 | $(this).val(text); |
237 | 237 | }); |
238 | 238 | |
239 | - $('textarea[data-placeholder]').on('focus', function () { | |
240 | - if ($(this).attr('data-placeholder') === $(this).val()) { | |
241 | - $(this).attr('data-placeholder', $(this).val()); | |
242 | - $(this).val(''); | |
243 | - $(this).removeClass('active'); | |
244 | - } | |
245 | - }); | |
246 | - | |
247 | - $('textarea[data-placeholder]').on('blur', function () { | |
248 | - if ($(this).val() === '') { | |
249 | - var text = $(this).attr('data-placeholder'); | |
250 | - $(this).val(text); | |
251 | - $(this).addClass('active'); | |
252 | - } | |
253 | - }); | |
239 | + $('textarea[data-placeholder]') | |
240 | + .on('focus', function () { | |
241 | + if ($(this).attr('data-placeholder') === $(this).val()) { | |
242 | + $(this).attr('data-placeholder', $(this).val()); | |
243 | + $(this).val(''); | |
244 | + $(this).removeClass('active'); | |
245 | + } | |
246 | + }) | |
247 | + .on('blur', function () { | |
248 | + if ($(this).val() === '') { | |
249 | + $(this).val($(this).attr('data-placeholder')); | |
250 | + $(this).addClass('active'); | |
251 | + } | |
252 | + }) | |
253 | + ; | |
254 | 254 | } |
255 | 255 | }); |
256 | 256 | |
257 | + | |
258 | +// Make sure the lists of cities are not required if we set files instead. | |
259 | +$(() => { | |
260 | + $("#origin_addresses_file").change(() => { | |
261 | + $("#origin_addresses").attr('required', null); | |
262 | + }); | |
263 | + $("#destination_addresses_file").change(() => { | |
264 | + $("#destination_addresses").attr('required', null); | |
265 | + }); | |
266 | +}); | |
267 | + | |
268 | + | |
269 | + | |
257 | 270 | </script> |
258 | 271 | {% endblock %} | ... | ... |