title: MVC 5 Remote Validation
body: <p>I need to validate an input field value from user before the form is submitted.</p>
  
  <p>I have created an action in my custom controller and decorated the field with it:</p>
  
  <p>action name:      <code>CheckValue</code>
     controller name:  <code>Validate</code></p>
  
  <pre><code>[Remote("CheckValue", "Validate"), ErrorMessage="Value is not valid"]
  public string Value { get; set; }
  </code></pre>
  
  <p>The problem is when I press submit, the form is being submitted and then the message <code>Value is not valid</code> is shown if the value entered by the user is not valid.</p>
  
  <p>How can I validate the value entered by user and prevent the form to be submitted if value is not valid, and display the error message?</p>
  
  <p>If I try in JavaScript to check if the form is valid <code>$("#formId").valid()</code> that returns true, that means no matter what is the status of the value (valid or not) the form is valid.</p>
  
  <p>In the other hand if I decorate another field with the <code>[Required]</code> attribute the form is not submitted and the error is shown for that field that is required. However the validation doesn't occur behind the scene for the remote validation field.</p>