First, when submitting a web form, if you want to check the legality of the data of the form field, first add an onSubmit event in the form tag: