Check if onFormPassword is defined before calling it.