Web App alert box or toast for validation messages

249 views
Skip to first unread message

Jon Couch

unread,
Oct 3, 2021, 6:51:02 PM10/3/21
to Google Apps Script Community
I have been working with web apps for about a year and I'm still very green. I have an html form that I want to run simple validation on when it is submitted. I have found plenty of doc on alert messages and some applications of toast but they all seem to be used in spreadsheet applications where the user views the message in an active sheet.  I think what I need is an alert box that appears on the html page announcing the validation error and then clears (or is cleared) without having to "reload" the underlying form html. I thought toast was the solution but I can only find applications on spreadsheets not web apps.

Can anyone point me to some doc or sample code that would explain how to do this in a freestanding web app?

Thanks for your help!

Clark Lind

unread,
Oct 4, 2021, 10:59:04 AM10/4/21
to Google Apps Script Community
Assuming this is NOT a Google Form but is an html "form", all of this is done within either the html file using normal
 <script>
   javascript
</script>

or within a linked javascript file. You will want to do this in the browser on the client side, not the backend. 
You could do your own validation, or use another library (examples: validate.js &  approvejs show up on a quick Github search) that has already been done for you :)
Reply all
Reply to author
Forward
0 new messages