title: inputText empty check
body: <p>I am using JSF, I have an h:inputText text box,</p>
  
  <pre><code>&lt;h:form&gt;
                      Please enter your username:
                      &lt;h:inputText value="#{user.id}"/&gt;&lt;br/&gt;&lt;br/&gt;
  </code></pre>
  
  <p>and I wish when the user presses the submit button,</p>
  
  <pre><code>&lt;h:commandButton value="Submit" action="upload/uploadText"/&gt;
  </code></pre>
  
  <p>for it to check if there is a value entered in the input text box and that it is over 6 characters in length</p>
  
  <p>how would i do this ?</p>
  
  <p>code i have tried :</p>
  
  <pre><code>&lt;script type="text/javascript"&gt; 
  
          function required(){  
              if (document.getElementById("Username").value.length == 0)  
              {   
                  alert("message");        
                  return false;   
              }       
              return true;   
          }
  
      &lt;/script&gt; 
  </code></pre>
  
  <p>with this :</p>
  
  <pre><code>&lt;h:body&gt;
  
                  &lt;h:form onsubmit="return required();"&gt;
                      Please enter your username:
                      &lt;h:inputText id="Username" value="#{user.id}"&gt;
                      &lt;/h:inputText&gt;&lt;br&gt;&lt;/br&gt;&lt;br&gt;&lt;/br&gt;
  
                      To print a piece of text, please press the submit button below to upload the text:&lt;br/&gt;&lt;br/&gt;
                      &lt;h:commandButton type="submit" value="Submit" action="upload/uploadText"/&gt;
                  &lt;/h:form&gt;
  
              &lt;/h:body&gt;
  </code></pre>
  
  <p>and I still am unable to get the script to run</p>