How to properly validate web form

I have created a webform i when write code for validation in corresponding python file i get error in chromes console window why is that

def validate(self):

http://localhost:8003/ 417 (EXPECTATION FAILED)

frappe-web.min.js:1573 Traceback (most recent call last):
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/”, line 55, in application
response = frappe.handler.handle()
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/”, line 19, in handle
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/”, line 40, in execute_cmd
ret =, **frappe.form_dict)
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/”, line 898, in call
return fn(*args, **newargs)
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/website/doctype/web_form/”, line 405, in accept
doc.insert(ignore_permissions = True)
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/model/”, line 189, in insert
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/model/”, line 750, in run_before_save_methods
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/model/”, line 651, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/model/”, line 858, in composer
return composed(self, method, *args, **kwargs)
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/model/”, line 841, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/model/”, line 645, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/shahid/meeting/frappe-bench/apps/erpnext/erpnext/schools/doctype/corporate_registration/”, line 13, in validate
File “/home/shahid/meeting/frappe-bench/apps/erpnext/erpnext/schools/doctype/corporate_registration/”, line 27, in validate_email
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/”, line 310, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/”, line 303, in msgprint
File “/home/shahid/meeting/frappe-bench/apps/frappe/frappe/”, line 276, in _raise_exception
raise raise_exception, encode(msg)
ValidationError: error

Hi, as I see your problem in the code erpnext/erpnext/schools/doctype/corporate_registration/", line 27, in validate_email frappe.throw(_("error"))
please check which code you have before 27 line.

@SwitsolAG i get error on while using frappe.throw()

but when i use frappe.msgprint() no error but form is submitting even validation is failed


can you share your code ?


sorry, but honestly speaking as for me it works properly, why not? if you use throw it cannot be saved if you use msgprint it can be saved


yes it is also happening for me but i got errror message in console of chrome at the end