Simplify front-end error-clearing logic.

This commit is contained in:
Sage Vaillancourt 2022-09-29 13:31:58 -04:00
parent 5024a79842
commit c7229d5db1
1 changed files with 2 additions and 6 deletions

View File

@ -32,7 +32,7 @@
const clearErrors = () => {
const e = document.getElementById('letter_errors')
e.parentNode.removeChild(e)
e?.parentNode.removeChild(e)
}
</script>
{% endblock head %}
@ -106,11 +106,7 @@
<a href="javascript:void(0)"
class="wipe up-wipe"
style="margin-bottom: 1em;"
{% if letter_errors %}
onclick="clearErrors();document.getElementById('letter-form').submit()"
{% else %}
onclick="document.getElementById('letter-form').submit()"
{% endif %}
>Generate PDF</a>
</div>
</form>