Edited hidden content no always shows
My website has a form asking for the visitors contact info. Upon clicking on the submit button, if any of the required fields is not (correctly) filled out, a text will show clarifying the corrective action needed. For example, if the visitor forgets to put in their email address before hitting the submit button, red text appears next to the field box saying "please enter a valid email address."
Now, to edit these hidden texts, I go to interactive mode click on the submit button, they appear, and I can get edit them. The problem I am having is after editing, these hidden texts are no longer. They remain visible, even to first time visitors who have yet to take any action. For example, upon loading the page, the visitor will immediately see "Please enter a valid email address." before they have even had the chance to submit the form. How can I keep the changes made to these elements (ie changing the text), while maintaining their hidden status unless the trigger (incorrectly filled form submitted) is activated?
Thanks for your help!
Re: Edited hidden content no always shows
- add an event listener for the form submit button
- upon submit, check if there is an error
- if there is an error, show the error message, otherwise, don't do anything