You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tim Velten <tv...@insightbb.com> on 2006/03/07 20:29:24 UTC
validator message problem
I am having a problem using validators on TextFields.
My HTML looks like
<input jwcid="id@TextField" displayName="Id"
validators="validators:required" value="ognl:user.id" size="20"/>
When I submit my form the validator seems to work - the label changes to
red and a message is displayed in red - however the message is just "**"
- 2 asterisks (alsoin red).
I cannot seem to get the actual message to appear.
I have scoured the mailing list. I tried checking my locale and adding
<span jwcid="xx@Insert" value="ognl:engine.locale"/> and my locale shows
up as en_US. I have extracted ValidationStrings.properties from the
tapestry jar file and put the file in my root and also WEB-INF dirs with
no luck. Also copied to ValidationStrings_en.properties and
app.properties with no luck.
I added <meta key="org.apache.tapestry.accepted-locales" value="en"/> to
my app.application file - no luck.
I tried validators="validators:required[my message here]" syntax - still
worked but my message did not appear.
I have tried putting everything in the Home.page file instead of the
HTML - same result.
Same problem using other validators as well, so it is not just
"required" validator.
I must have some fundamental configuration problem that I am missing.
Everything else tapestry-wise is working fine.
Anybody have any ideas ?
Thanks,
Tim
--
Tim Velten <tv...@insightbb.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: validator message problem
Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Tuesday 07 March 2006 22:01, Tim Velten wrote:
> Oh, maybe I misunderstood.
> I thought the message should appear with and/or where the red stars
> appeared. Maybe it is just a marker of an error and I need to put the
> messages themselves on the page - where my design wants them - which
> Tapestry couldn't know.
You can do that yourself quite easily.
Make yourself a class which extends ValidationDelegate, and implement one of
the writeXXX routines (such as write writeSuffix)
public void writeLabelSuffix(IFormComponent component, IMarkupWriter writer,
IRequestCycle cycle) {
- if (isInError(component)) {
- setFormComponent(component);
- IFieldTracking tracking = getComponentTracking();
- if (tracking != null) {
- IRender renderer = tracking.getErrorRenderer();
- renderer.render(writer,cycle);
- }
- writer.end();
- }
}
--
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: validator message problem
Posted by Tim Velten <tv...@insightbb.com>.
Oh, maybe I misunderstood.
I thought the message should appear with and/or where the red stars
appeared. Maybe it is just a marker of an error and I need to put the
messages themselves on the page - where my design wants them - which
Tapestry couldn't know.
That makes sense. I will try that tonight.
Thanks,
Tim
On Tue, 2006-03-07 at 15:52 -0600, matt wear wrote:
> I'm not sure how to get error messages to appear directly next the
> fields that are invalid, but Kent Tong's tapestry book gives a method
> where you can iterate the error messages in a block above your form.
> You can download chapters 1-4 for free (chapter 3 will tell you how to
> do this) at http://www.agileskills2.org/EWDT/ . Hope this is of some help.
>
> Tim Velten wrote:
> > I am having a problem using validators on TextFields.
> >
> > My HTML looks like
> >
> > <input jwcid="id@TextField" displayName="Id"
> > validators="validators:required" value="ognl:user.id" size="20"/>
> >
> > When I submit my form the validator seems to work - the label changes to
> > red and a message is displayed in red - however the message is just "**"
> > - 2 asterisks (alsoin red).
> >
> > I cannot seem to get the actual message to appear.
> >
> > I have scoured the mailing list. I tried checking my locale and adding
> > <span jwcid="xx@Insert" value="ognl:engine.locale"/> and my locale shows
> > up as en_US. I have extracted ValidationStrings.properties from the
> > tapestry jar file and put the file in my root and also WEB-INF dirs with
> > no luck. Also copied to ValidationStrings_en.properties and
> > app.properties with no luck.
> >
> > I added <meta key="org.apache.tapestry.accepted-locales" value="en"/> to
> > my app.application file - no luck.
> >
> > I tried validators="validators:required[my message here]" syntax - still
> > worked but my message did not appear.
> >
> > I have tried putting everything in the Home.page file instead of the
> > HTML - same result.
> >
> > Same problem using other validators as well, so it is not just
> > "required" validator.
> >
> > I must have some fundamental configuration problem that I am missing.
> > Everything else tapestry-wise is working fine.
> >
> > Anybody have any ideas ?
> >
> > Thanks,
> > Tim
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
> v
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: validator message problem
Posted by matt wear <ma...@smartblast.com>.
I'm not sure how to get error messages to appear directly next the
fields that are invalid, but Kent Tong's tapestry book gives a method
where you can iterate the error messages in a block above your form.
You can download chapters 1-4 for free (chapter 3 will tell you how to
do this) at http://www.agileskills2.org/EWDT/ . Hope this is of some help.
Tim Velten wrote:
> I am having a problem using validators on TextFields.
>
> My HTML looks like
>
> <input jwcid="id@TextField" displayName="Id"
> validators="validators:required" value="ognl:user.id" size="20"/>
>
> When I submit my form the validator seems to work - the label changes to
> red and a message is displayed in red - however the message is just "**"
> - 2 asterisks (alsoin red).
>
> I cannot seem to get the actual message to appear.
>
> I have scoured the mailing list. I tried checking my locale and adding
> <span jwcid="xx@Insert" value="ognl:engine.locale"/> and my locale shows
> up as en_US. I have extracted ValidationStrings.properties from the
> tapestry jar file and put the file in my root and also WEB-INF dirs with
> no luck. Also copied to ValidationStrings_en.properties and
> app.properties with no luck.
>
> I added <meta key="org.apache.tapestry.accepted-locales" value="en"/> to
> my app.application file - no luck.
>
> I tried validators="validators:required[my message here]" syntax - still
> worked but my message did not appear.
>
> I have tried putting everything in the Home.page file instead of the
> HTML - same result.
>
> Same problem using other validators as well, so it is not just
> "required" validator.
>
> I must have some fundamental configuration problem that I am missing.
> Everything else tapestry-wise is working fine.
>
> Anybody have any ideas ?
>
> Thanks,
> Tim
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org