Client script to validate field: showError and prevent Save

Client script to validate field: showError and prevent Save

I am pretty new to Zoho CRM customization and I would like to know which is the best practise to use client script for field validation.
I developed a very simple function to validate "onChange" of a field. When the user enters an invalid value, the script displays an error message
  1. myfield.showError("This value is invalid");
and the user can see a red message just below the field. It works perfectly, but if the user saves the record, the invalid value is accepted.
Using client script, what is the best technique to prevent from saving the record when the field entered is invalid?

Thanks for your help,

                        Zoho Marketing Automation

                                Manage your brands on social media

                                        Zoho TeamInbox Resources

                                          Zoho DataPrep Resources

                                            Zoho CRM Plus Resources

                                              Zoho Books Resources

                                                Zoho Subscriptions Resources

                                                  Zoho Desk Resources

                                                    Zoho Projects Resources

                                                      Zoho Sprints Resources

                                                        Qntrl Resources

                                                          Zoho Creator Resources

                                                            Zoho WorkDrive Resources

                                                              Zoho Campaigns Resources

                                                                Zoho CRM Resources

                                                                • CRM Community Learning Series

                                                                  CRM Community Learning Series

                                                                • Tips


                                                                • Functions


                                                                • Meetups


                                                                • Kbase


                                                                • Resources


                                                                • Digest


                                                                • CRM Marketplace

                                                                  CRM Marketplace

                                                                • MVP Corner

                                                                  MVP Corner

                                                                • Word of the Day

                                                                  Word of the Day

                                                                        Design. Discuss. Deliver.

                                                                        Create visually engaging stories with Zoho Show.

                                                                        Get Started Now