I've written a custom Renderer Class to fix Primefaces issue#5869 and am now trying to use it on the website I'm working on. I've done so by including
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.inputtext.InputTextRenderer</renderer-type>
<renderer-class>at.ac.uibk.library.utils.fixedInputTextRenderer</renderer-class>
</renderer>
in my faces-config.xml. But it's still possible to insert more than the specified character limit with js.
I added these lines in the fixedInputTextRenderer which should do the necessary check
if (submittedValue != null) {
int maxlength = inputText.getMaxlength();
if (maxlength > 0 && submittedValue.length() > maxlength) {
submittedValue = submittedValue.substring(0, maxlength);
}
inputText.setSubmittedValue(submittedValue);
}
The specified <renderer-type>
is wrong:
<renderer-type>org.primefaces.component.inputtext.InputTextRenderer</renderer-type>
According to the VDL documentation of <p:inputText>
it's by default registered on org.primefaces.component.InputTextRenderer
.
Component information
Info Value Component Type org.primefaces.component.InputText
Handler Class None Renderer Type org.primefaces.component.InputTextRenderer
Description None
So adjust it accordingly:
<renderer-type>org.primefaces.component.InputTextRenderer</renderer-type>
Do note that the component type and renderer type don't actually represent FQNs, but that they are merely keys/identifiers. That they look like FQNs is indeed an unfortunate side effect of enforcing uniqueness which may indeed be confusing for starters.