Add a form state check when the menu item to generate SQL is triggered (which can happen from login form using shortcut keys)