What I’m trying to do:
I would like to modify Anvil’s somewhat disconcerting alert (see image below) with a simple browser notification like: alert (‘Registration canceled. Please try again.’).
This doesn’t work as it is obviously way past usertype definition. Is it possible to modify this Anvil alert or if not, just add a more subdued browser alert?
Yes. I was more concerned about the TypeError alert that shows when running the app. I just wanted to alert the user that it’s not a ‘fatal’ error as may be implied by the alarming red border.
I think I will try the Custom Error Handler option.
Here’s the Custom Error Handler that served my purpose.
def error_handler(self):
err = 'Dismiss this error and try again.'
alert(str(err), title="This is a non-fatal TypeError.")
set_default_error_handling(error_handler)
def drop_down_usertype_change(self, **event_args):
user = anvil.users.signup_with_form(allow_cancel=True)
if user ==None:
self.error_handler(err)
return