Force JSF to process, validate and update readonly/disabled input components anyway

That’s the effect of JSF’s safeguard against tampered/attacked requests wherein the hacker attempts to circumvent the readonly (and disabled) attribute by manipulating the HTML DOM and/or the HTTP request. Instead of <x:inputXxx … readonly=”true”> use <x:inputXxx … readonly=”#{facesContext.currentPhaseId.ordinal eq 6}”> or <x:inputXxx … readonly=”#{not facesContext.postback or facesContext.renderResponse}”> This makes sure that readonly is only effective … Read more

Min / Max Validator in Angular 2 Final

To apply min/max validation on a number you will need to create a Custom Validator Validators class currently only have a few validators, namely required requiredTrue minlength maxlength pattern nullValidator compose composeAsync Validator: Here is toned down version of my number Validator, you can improve it as you like static number(prms = {}): ValidatorFn { … Read more

How to perform validation in JSF, how to create a custom validator in JSF

The standard way is to implement the Validator interface. @FacesValidator(“fooValidator”) public class FooValidator implements Validator { @Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { // … if (valueIsInvalid) { throw new ValidatorException(new FacesMessage(“Value is invalid!”)); } } } The @FacesValidator will register it to JSF with validator ID myValidator so that … Read more

Validation Error: Value is not valid

Validation fails with the message “form:location: Validation Error: Value is not valid” This error boils down to that the selected item does not match any of the available select item values specified by any nested <f:selectItem(s)> tag during processing of the form submit request. As part of safeguard against tampered/hacked requests, JSF will reiterate over … Read more