<t:error/> component

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

<t:error/> component

vlamp
Hello everybody

I'm trying to figure out why the <t:error> (singular) component is not
working for me. No difficulties with <t:errors/> (plural) in the same place.

The error is recorded with a reference to the field. Inspecting the form's
ValidationTracker contains the expected error. Likewise, <t:error> is
referencing that field with the for attribute.

The field and the error component are also encapsulated by a Form component
and a <div class="form-group">.

All that gets rendered is:
<p data-error-block-for="linkSearch_101575139e52" class="help-block
invisible"></p>
No inner HTML instead of the expected error message.

So I looked at the Error.java
<https://github.com/apache/tapestry-5/blob/master/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Error.java>
to understand how the component works. Apparently it never generated any
inner HTML. Also, I was expecting to find some sort of reference to
ValidationTracker, but there is none.

Any ideas anybody, please?

Volker
Reply | Threaded
Open this post in threaded view
|

Re: <t:error/> component

Ben Weidig
Hi Volker,

I believe the actual error message is done with JS:

https://github.com/apache/tapestry-5/blob/0229bd59d44de848ae7412c8161bde6afe75ab84/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee#L173

https://github.com/apache/tapestry-5/blob/73e327b4f89639dee922713164dec05ff2d9a3e9/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java#L287

What kind of field is the t:error for? Did you record the error manually,
or use a validator?


Cheers
Ben



On Mon, Nov 2, 2020 at 2:22 PM Volker Lamp <[hidden email]> wrote:

> Hello everybody
>
> I'm trying to figure out why the <t:error> (singular) component is not
> working for me. No difficulties with <t:errors/> (plural) in the same
> place.
>
> The error is recorded with a reference to the field. Inspecting the form's
> ValidationTracker contains the expected error. Likewise, <t:error> is
> referencing that field with the for attribute.
>
> The field and the error component are also encapsulated by a Form component
> and a <div class="form-group">.
>
> All that gets rendered is:
> <p data-error-block-for="linkSearch_101575139e52" class="help-block
> invisible"></p>
> No inner HTML instead of the expected error message.
>
> So I looked at the Error.java
> <
> https://github.com/apache/tapestry-5/blob/master/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Error.java
> >
> to understand how the component works. Apparently it never generated any
> inner HTML. Also, I was expecting to find some sort of reference to
> ValidationTracker, but there is none.
>
> Any ideas anybody, please?
>
> Volker
>
Reply | Threaded
Open this post in threaded view
|

Re: <t:error/> component

vlamp
Thank you, Ben. Your response helped me understand how <t:error> actually
works.

The problem I described was due to AJAX-based form submission. The form was
nested in the zone that got rerendered onFailure().


Am Mo., 2. Nov. 2020 um 16:09 Uhr schrieb Ben Weidig <[hidden email]>:

> Hi Volker,
>
> I believe the actual error message is done with JS:
>
>
> https://github.com/apache/tapestry-5/blob/0229bd59d44de848ae7412c8161bde6afe75ab84/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee#L173
>
>
> https://github.com/apache/tapestry-5/blob/73e327b4f89639dee922713164dec05ff2d9a3e9/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java#L287
>
> What kind of field is the t:error for? Did you record the error manually,
> or use a validator?
>
>
> Cheers
> Ben
>
>
>
> On Mon, Nov 2, 2020 at 2:22 PM Volker Lamp <[hidden email]> wrote:
>
> > Hello everybody
> >
> > I'm trying to figure out why the <t:error> (singular) component is not
> > working for me. No difficulties with <t:errors/> (plural) in the same
> > place.
> >
> > The error is recorded with a reference to the field. Inspecting the
> form's
> > ValidationTracker contains the expected error. Likewise, <t:error> is
> > referencing that field with the for attribute.
> >
> > The field and the error component are also encapsulated by a Form
> component
> > and a <div class="form-group">.
> >
> > All that gets rendered is:
> > <p data-error-block-for="linkSearch_101575139e52" class="help-block
> > invisible"></p>
> > No inner HTML instead of the expected error message.
> >
> > So I looked at the Error.java
> > <
> >
> https://github.com/apache/tapestry-5/blob/master/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Error.java
> > >
> > to understand how the component works. Apparently it never generated any
> > inner HTML. Also, I was expecting to find some sort of reference to
> > ValidationTracker, but there is none.
> >
> > Any ideas anybody, please?
> >
> > Volker
> >
>