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