Thanks to Thiago i found a clean solution:

@Environmental
private ValidationTracker tracker;


Using this envirnmental service one can record validation messages without
throwing exceptions and without having the surrounding form component at hand.

thanks thiago

felix


On 04.10.2011 12:38, Felix Gonschorek wrote:
> Lenny and Steve,
>
> thank you for your responses. I updated testwise to 5.2.6, but the behaviour
> does not change here.
>
> @Lenny: Can't do component.recordError(), since i need the form component to 
> do
> so. The form component is defined a few component layers above and i would 
> have
> to pass it down as a parameter through all nested components. I would like to
> find a better solution. Is there a way to access the sourrounding Form or some
> validation tracker to record a message for a specific form field? I have
> searched some services (FormSupport etc.) but could not find a entry point 
> for a
> solution.
>
> any hint apreciated :)
>
> thx
> felix
>
> On 03.10.2011 06:06, Steve Eynon wrote:
>> Hi Felix,
>>
>> I remember seeing the same behaviour you mention in the past -
>> ValidationExceptions being handled correctly but also being logged as
>> an error. But I've not seen it happen in a while now and after a quick
>> test I'm not able to replicate it either. We're using T5.2.6, you may
>> want to try updating to see if the problem still exists.
>>
>> Steve.
>>
>>
>> On 2 October 2011 01:31, Lenny Primak <lpri...@hope.nyc.ny.us> wrote:
>>> I think you can do <component>.recordError() to do the same thing without 
>>> throwing the exception. Since no one is handling the exception in your case 
>>> it just flows to the standard error handler and sends you the email.
>>>
>>>
>>>
>>> On Oct 1, 2011, at 12:15 PM, Felix Gonschorek <fe...@netzgut.net> wrote:
>>>
>>>> Hi all,
>>>>
>>>> i encountered a undesired behaviour in our apps: When using an "validate"
>>>> component event handler that validates a single field and this handler 
>>>> throws an
>>>> org.apache.tapestry5.ValidationException, this exception is logged with 
>>>> level ERROR:
>>>>
>>>> <snip>
>>>> [ERROR] ioc.Registry org.apache.tapestry5.ValidationException: ERROR
>>>> [ERROR] ioc.Registry Operations trace:
>>>> [ERROR] ioc.Registry [ 1] Triggering event 'action' on Test:form
>>>> [ERROR] ioc.Registry [ 2] Triggering event 'validate' on Test:textfield
>>>> </snap>
>>>>
>>>> this is the event handler:
>>>>
>>>> <snip>
>>>>   @OnEvent(value = EventConstants.VALIDATE, component = "textfield")
>>>>   void onValidateFromTextfield(String value) throws ValidationException {
>>>>       throw new ValidationException("ERROR");
>>>>   }
>>>> </snap>
>>>>
>>>> Is this a desired behaviour? I think something like a full disk, a 
>>>> disconnected
>>>> database or not enough RAM is an error, but not a failing user validation.
>>>>
>>>> - The page renders fine
>>>> - The validation exception message is displayed to the user
>>>> - so everything is okay, but the superfluous ERROR log - level statement.
>>>>
>>>> This happens with tapestry 5.2.5 - is something wrong with my code?
>>>>
>>>> I could ignore this, but i have configured our logging system to send
>>>> alert-mails in case of an ERROR level log entry, an now i am getting mails 
>>>> evey
>>>> time a user enters a invalid data Oo.
>>>>
>>>> I will file a bug report if i am not completely off the track, so if 
>>>> someone can
>>>> get me short feedback i would be greatful.
>>>>
>>>> thanks
>>>> felix
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to