title: Scrolling to anchor or page bottom after JSF form validation fail
body: <p>I have a contact form at the bottom of a page with required and validated form fields. If validation fails, how can I get the scroll position back to the bottom of the page? </p>
  
  <p>I want this page to work with Javascript disabled, so no AJAX solutions. I have something like this:</p>
  
  <pre><code>&lt;a id="contact"&gt;&lt;/a&gt;
  &lt;h:form id="cform"&gt;
      &lt;h5&gt;Contact!&lt;/h5&gt;
  
      &lt;h:outputLabel for="name"&gt;Name: 
          &lt;h:message id="nameMsg"  for="name" /&gt;
      &lt;/h:outputLabel&gt;
  
      &lt;h:inputText id="name" value="#{bean.name}" required="true" requiredMessage="Please enter name!" /&gt;
  
      &lt;h:outputLabel for="email"&gt;Email: 
          &lt;h:message id="emailMsg" for="email" /&gt;
      &lt;/h:outputLabel&gt;
  
      &lt;h:inputText id="email" value="#{bean.email}" required="true" requiredMessage="Email is required!"&gt;
          &lt;f:validator validatorId="myValidator" /&gt;
      &lt;/h:inputText&gt;
  
      &lt;h:outputLabel for="comment"&gt;Comment: 
          &lt;h:message id="commentMsg" for="comment" /&gt;
      &lt;/h:outputLabel&gt;
  
      &lt;h:inputTextarea id="comment" value="#{bean.comment}" required="true" requiredMessage="Please enter a comment!"/&gt;
  
      &lt;h:commandButton action="#{bean.go}" id="send" value="send" /&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>I thought about doing validations on the bean side and doing manual redirects to the appropriate anchor, but that seems to defeat the purpose of using JSF to begin with. I assume there is an easy way to do this, but I'm having trouble Googling a solution because I'm probably not wording the question right. Any one?</p>