Hi there.

I was trying to implement a custom ValidationDecorator (something like this
one
http://tapestry.1045711.n5.nabble.com/Example-of-overriding-the-default-ValidationDecorator-tt2419072.html)
but I am having a small problem.

When I try to use "field.isRequired()" in the method "public void
insideLabel(Field field, Element labelElement)" (like in the above example)
I am receiving the following error.

Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: No object
of type org.apache.tapestry5.services.PropertyEditContext is available from
the Environment.
at
org.apache.tapestry5.internal.services.EnvironmentImpl.peekRequired(EnvironmentImpl.java:88)
at $Environment_1bf8978a551.peekRequired(Unknown Source)
at $Environment_1bf8978a4b4.peekRequired(Unknown Source)
at
org.apache.tapestry5.internal.transform.EnvironmentalWorker$EnvironmentalConduit.get(EnvironmentalWorker.java:59)
at
org.apache.tapestry5.corelib.pages.PropertyEditBlocks.conduit_get_context(PropertyEditBlocks.java)
at
org.apache.tapestry5.corelib.pages.PropertyEditBlocks.getTextFieldValidator(PropertyEditBlocks.java:111)
at $InternalPropertyConduit_1bf8978a687.get(Unknown Source)
at
org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:59)
... 137 more


If I try to do it in the method "public void beforeLabel(Field field)" I
can find the PropertyEditContext in the Environment. The beaneditor should
not inject the PropertyEditContext for the bean property? Why it can be
found on the Environment in the beforeLabel but not in the insideLabel? I
am sure I must be missing something, but I can't see what.

I am using a form with a beaneditor in my tml, and using a decorator in the
AppModule for the ValidationDecoratorFactory in order to return an instance
of my CustomValidationDecorator instead of the DefaultValidationDecorator.

PS: I already have it working through a workaround but I would love to know
why I am not being capable to do it as I think it should be done.

Thanks for the attention.

Best regards,
Sérgio Areias

Reply via email to