Client Side Validation Problem with validator

UI Components for JSF
Post Reply
LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

22 Mar 2018, 10:31

Hi.

I've got a gernic data model which uses validators based on the Java Functional Interfaces. Every kind of data is validate correct, but when I use the client side validation I've got strange results as you can see below.

1. Validator is called in both ways, validation error is correct.
2. With client side validation enabled, the i18n is not done. (I use a javax.faces.validator.ValidatorException from the Validator for this) Looks like it just shows default messages.
3. With client side validation enabled, the message is shown in every p:message tag for every input component.

Without PF Client Side Validation:
Image

With PF Client Side Validation:
Image

Example PF code of the composite component:

Code: Select all

		...
		
		<p:outputLabel
			id="lbl_inpIntegerProperty"
			rendered="#{cc.attrs.propertyHelper.isIntegerInput(cc.attrs.propertyConstraint)}"
			value="#{cc.attrs.propertyConstraint.name}"
			for="inp_inpIntegerProperty"
			title="" />
		<p:inputNumber
			id="inp_inpIntegerProperty"
			rendered="#{cc.attrs.propertyHelper.isIntegerInput(cc.attrs.propertyConstraint)}"
			required="#{cc.attrs.required}"
			requiredMessage="#{i18NHelper.translateValidation('contraintType0')}"
			disabled="#{cc.attrs.disabled}"
			styleClass="defaultInputBox"
			validator="#{cc.attrs.propertyHelper.getValidator(cc.attrs.propertyConstraint, i18NHelper).validate}"
			value="#{cc.attrs.value}"
			thousandSeparator="."
			decimalPlaces="0"
			title="" />
		<p:messages
			id="msg_inpIntegerProperty"
			rendered="#{cc.attrs.propertyHelper.isIntegerInput(cc.attrs.propertyConstraint)}"
			showIcon="false"
			for="inp_inpIntegerProperty"
			styleClass="defaultMessages" />

		<p:outputLabel
			id="lbl_inpDoubleProperty"
			rendered="#{cc.attrs.propertyHelper.isDoubleInput(cc.attrs.propertyConstraint)}"
			value="#{cc.attrs.propertyConstraint.name}"
			for="inp_inpDoubleProperty"
			title="" />
		<p:inputNumber
			id="inp_inpDoubleProperty"
			rendered="#{cc.attrs.propertyHelper.isDoubleInput(cc.attrs.propertyConstraint)}"
			required="#{cc.attrs.required}"
			requiredMessage="#{i18NHelper.translateValidation('contraintType0')}"
			disabled="#{cc.attrs.disabled}"
			styleClass="defaultInputBox"
			validator="#{cc.attrs.propertyHelper.getValidator(cc.attrs.propertyConstraint, i18NHelper).validate}"
			value="#{cc.attrs.value}"
			thousandSeparator="."
			decimalSeparator=","
			decimalPlaces="2"
			title="" />
		<p:messages
			id="msg_inpDoubleProperty"
			rendered="#{cc.attrs.propertyHelper.isDoubleInput(cc.attrs.propertyConstraint)}"
			showIcon="false"
			for="inp_inpDoubleProperty"
			styleClass="defaultMessages" />
		
		...
Thanks.

Lars

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

22 Mar 2018, 15:07

Could be composite component related...

LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

12 Apr 2018, 09:01

Does anybody from PF has some comment about it?

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

12 Apr 2018, 09:41

Do you have any comment on my comment? Tried if it makes a difference if you DON'T use a composite component?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests