2

I've built several custom validator beans and registered them through the database's faces-config. This is mostly working as expected.

I tried both methods that are described in Jeremy Hodges blog post:

a) calling a managed bean through the control's validator attribute as in

validator="#{myBean.validate}"

b) binding the validate method to the control's xp:validator complex attribute as in

<xp:this.validators>
  <xp:validator validatorId="myValidator"></xp:validator>
</xp:validators>

Validation works as expected as long as the control to be validated contains a value; it's not firing at all if the control's value is null. This leads me to the conclusion that somehow a standard required validator (xp:validateRequired) must be invoked somehow differently from other validators. Question is: how can I get my customValidator to be called in a situation where a requiredValidator would be fired?

Lothar Mueller
  • 2,528
  • 1
  • 16
  • 29

1 Answers1

1

Yes, requiredValidators have to be handled differently. Have you tried Sven Hasselbach's advice on his blog? http://hasselba.ch/blog/?p=764

Also, Sven's answer on this quesstion about custom validators might be worth considering when creating validators customValidator without requiredValidator?.

Community
  • 1
  • 1
Paul Stephen Withers
  • 15,699
  • 1
  • 15
  • 33