title: How do I perform validation on an api call while submitting form and produce necessary error message?
body: <p>My web app is an add-on service to another existing web-app. </p>
  
  <p>Users may sign up to my web-app but first I must check if they are registered on the dependent web app. </p>
  
  <p>I can do so by getting their username/password key and send it as parameters in an API CALL. If the call succeeds it returns their API TOKEN(to be used for further requests) else it returns a 404 error. If I receive the 404 error I'll just handle the exception by putting the error in a flash message. </p>
  
  <p>How do I do this after the form is submitted?</p>
  
  <p>I should generate an error which shows that the user is not registered on the web-app which my web-app depends on.</p>