juergenweb / FrontendForms

A module for ProcessWire CMS to create and validate forms on the frontend easily using the Valitron library.
MIT License
15 stars 1 forks source link

prevent error if no textarea is present #9

Closed jmartsch closed 2 months ago

jmartsch commented 2 months ago

on a page without forms I get the error "Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')"

This fix prevents this.

jmartsch commented 2 months ago

That is because it tries to add an eventListener even if the element does not exist

juergenweb commented 2 months ago

Thanks! I have added your suggestion to the JS file.