When I enable field length validation it validates only when I submit the form...
<?xml version="1.0" encoding="UTF-8"?>
<xp:inputText id="inputText1">
<xp:this.validators>
<xp:validateLength maximum="20"
message="You can input max 20 characters">
</xp:validateLength>
</xp:this.validators>
</xp:inputText>
<xp:message id="message1" for="inputText1"></xp:message>
so how to show the error message once user typed in 21st character? Assume need a code for CSJS...
Add an client side event handler "onkeyup" to your inputText control:
It shortens the text to max length if necessary.
You can show the message as alert
or you can add a client message text field to your XPages and fill it with the message whenever the max length was reached