39 lines
1.5 KiB
HTML
39 lines
1.5 KiB
HTML
<?xml version='1.0' encoding='UTF-8' ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
|
|
|
xmlns:p="http://primefaces.org/ui"> <h:head>
|
|
<h:outputScript library="js" name="do_validation.js"/>
|
|
</h:head>
|
|
<h:body>
|
|
<h1>Validation with javascript and primefaces</h1>
|
|
<br/>
|
|
<h:form>
|
|
alphanumeric input only javascript called:
|
|
<h:inputText id="id2" value="#{controlRender.text}"
|
|
onkeyup="validateText('submitFormId:id2')"/>
|
|
|
|
<br/><br/>
|
|
|
|
only letters and numbers regex:
|
|
<p:inputMask title="type in name, only alphanumeric characters (I'm looking at you, Elon Musk)." value="#{controlRender.userName}">
|
|
<p:keyFilter regEx="/[A-Za-z0-9]/"/>
|
|
</p:inputMask>
|
|
|
|
<br/><br/>
|
|
|
|
only numbers mask:
|
|
<p:inputMask value="#{controlRender.mask}" mask="99-(999) 999-9999"/>
|
|
|
|
<br/><br/>
|
|
|
|
only letters mask:
|
|
<p:inputMask value="#{controlRender.mask}" mask="aaa"/>
|
|
<br/><br/>
|
|
rate: <p:rating value="#{controlRender.rate}"/>
|
|
<p:commandButton value="submit" action="#{controlRender.printToServer}"/>
|
|
|
|
</h:form>
|
|
</h:body>
|
|
</html> |