tags:

views:

157

answers:

1

Hello

I've seen BalusC's page on passing values to a validator but that is using inputText components. I'm using rich:inplaceInput components and it doesn't seem to work. Can someone tell me if it is possible, and if it is how to do simply?

Thanks

A: 

For sure you can add validators to rich:inplaceEdit. Here is an example:

<rich:inplaceEdit required="true" value="#{myBean.name}">
  <f:validateLength minimum="3" maximum="25" />
</rich:inplaceEdit>

This validates that the field is filled in (required="true") and that the entered text has a length between 3 and 25 characters ().

If you don't see any error message make sure you have a message component that displays your error message and that is properly updated.

Florian Gutmann
what about custom validators?
Mark Lewis
Should work as all the standard validators. They don't differ in terms of JSF as long as they implement the Validator interface.
Florian Gutmann
@Florian thanks for your comments. I want to pass values to the validator. As if to say, 'Validate the contents of the `rich:inplaceInput` and here's some other values'. With `a4j:commandButton` you can use `f:param` but I don't think you can with `rich:inplaceInput`s. How do I do this?
Mark Lewis