You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Mittendorf <ch...@freenet.de> on 2006/02/01 00:25:57 UTC
Using fieldTrackings
Hello!
I'm currently exploring how Tapestry 4 is validating fields and
tracking error messages.
Can someone please tell me if I'm right with the following assumptions:
- _every_ error is tracked in the ValidationDelegates fieldTrackings
- _only_ the content of form elements that extend ValidField or
implement TranslatedField is stored in FieldTrackings
Therefore only the following form elements will always be available
from the fieldTrackings, even if no error was recorded for them:
- DatePicker, TextArea, TextField (they implement TranslatedField)
- ValidField (as of Tapestry 4 deprecated)
This does lead me to the following question: why isn't the input of
other form elements (like i.e. Checkbox, PropertySelection) handled
the same way as TranslatedFields are?
Isn't this behavior contrary to the documentation of
IValidationDelegates method "recordFieldInputValue()". The JavaDocs say:
"Records the user's input for the current form component. Input
should be recorded even if
there isn't an explicit error, since later form-wide validations may
discover an error in the
field."
What I want to do is to show error messages from the form delegate
next to the form field (text field, check box, drop down, etc) where
the error is recorded. Is there a known way to do it?
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Daniel Lydiard <dl...@hotmail.com>.
Ah cool, thanks for the link, I'm not sure how I missed that one :P
----- Original Message -----
From: "Christian Mittendorf" <ch...@freenet.de>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, January 31, 2006 5:13 PM
Subject: Re: Using fieldTrackings
>
> Am 01.02.2006 um 02:03 schrieb Daniel Lydiard:
>
>> When ever a user chooses the "noSelectionValue" which is the
>> default, it's recorded in the validation delegate.
>>
>> Is this what you're going for?
>
> No, not really (I do also need the selected value in the validation
> delegate). But the hints and ideas until now were pretty helpful
> anyway. Now I've got to get some sleep ;-)
>
> By the way, you can do a PropertySelectionModel with a "no selection"
> label in Tapestry 4 by using this:
>
> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/
> tapestry/form/LabeledPropertySelectionModel.html
>
> Good night!
>
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Christian Mittendorf <ch...@freenet.de>.
Am 01.02.2006 um 02:03 schrieb Daniel Lydiard:
> When ever a user chooses the "noSelectionValue" which is the
> default, it's recorded in the validation delegate.
>
> Is this what you're going for?
No, not really (I do also need the selected value in the validation
delegate). But the hints and ideas until now were pretty helpful
anyway. Now I've got to get some sleep ;-)
By the way, you can do a PropertySelectionModel with a "no selection"
label in Tapestry 4 by using this:
http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/
tapestry/form/LabeledPropertySelectionModel.html
Good night!
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Daniel Lydiard <dl...@hotmail.com>.
No, I only throw them if input was incorrect. i.e. checkbox not checked and
it's required (using validators:required), or the pulldown value selected
was equal to the "noSelectionValue" (see ValidPropertySelection source code
in link below).
example:
<component id="someSelection" type="ValidPropertySelection">
<binding name="value" value="foo"/>
<binding name="model" value="barList"/>
<binding name="validators" value="validators:required"/>
<binding name="displayName" value="literal:some selection"/>
<binding name="noSelectionValue" value="literal:[Choose a value]"/>
</component>
When ever a user chooses the "noSelectionValue" which is the default, it's
recorded in the validation delegate.
Is this what you're going for?
----- Original Message -----
From: "Christian Mittendorf" <ch...@freenet.de>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, January 31, 2006 4:56 PM
Subject: Re: Using fieldTrackings
> That might be a solution: do ValidPropertySelection and ValidCheckbox
> record their input values to the ValidationDelegate in any case, even if
> no error occured?
>
>
> Am 01.02.2006 um 01:44 schrieb Daniel Lydiard:
>
>> I was actually using the ValidPropertySelection and ValidCheckbox in my
>> T3 code (http://issues.apache.org/bugzilla/show_bug.cgi? id=29535) and
>> ported it over to T4. I basically took the existing T4 source for
>> PropertySelection/Checkbox and added in the code to work with
>> ValidationDelegate (by throwing ValidatorException in
>> rewindFormComponent()). It was pretty straight forward.
>>
>> Is this what you were going for?
>>
>>
>> ----- Original Message ----- From: "Christian Mittendorf"
>> <ch...@freenet.de>
>> To: "Tapestry users" <ta...@jakarta.apache.org>
>> Sent: Tuesday, January 31, 2006 4:34 PM
>> Subject: Re: Using fieldTrackings
>>
>>
>>> Am 01.02.2006 um 01:20 schrieb Jesse Kuhnert:
>>>
>>>> Hmmm...I know the tapestry workbench demo application has a sample
>>>> "ShowErrors" sort of component for this.
>>>
>>> Ok, I think I'll have to check it.
>>>
>>>> The biggest reason I suggested the ValidationDelegate approach is
>>>> because
>>>> you're guaranteed to get every fields value and error written out
>>>> properly
>>>> as everything is passed in as a paramter to you.
>>>
>>> Are you sure that this approach is also working with
>>> PropertySelection or
>>> Checkboxes?
>>>
>>> Christian
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Christian Mittendorf <ch...@freenet.de>.
That must be the point, of course.
But why are form fields implemented in different ways?
There are fields like ie TextField, that record their input value
into the trackings, even if there was no error.
On the other side, PropertySelection or Checkbox, record only errors
into the trackings.
This is an inconsistent behaviour for elements, that are - in my
opinion - supposed to work similar.
It would be nice to know, in which direction the development of
Tapestry is heading. Will there be a "default behaviour" some time?
Christian
P.S. I've extended all form elements that I needed and changed some
methods, so that all form elements always register with
ValidationDelegate.
Am 01.02.2006 um 15:03 schrieb Ivano:
> My guess is that you won't need those fields unless you have some
> error to show and you want to tell the user which field was wrong.
> If this is the idea for the most common use of field validation,
> the consequence is that you don't want to take note of unused data.
>
> Ivano Pagano.
>
> Christian Mittendorf wrote:
>
>> Am 01.02.2006 um 01:56 schrieb Christian Mittendorf:
>>
>>> That might be a solution: do ValidPropertySelection and
>>> ValidCheckbox record their input values to the
>>> ValidationDelegate in any case, even if no error occured?
>>
>>
>> Thanks for the hints!
>>
>> I've implemented both classes and added the following code:
>>
>> rotected void rewindFormComponent(IMarkupWriter writer,
>> IRequestCycle cycle)
>> {
>> [...]
>> IValidationDelegate delegate = getForm().getDelegate();
>> if(delegate != null)
>> {
>> delegate.recordFieldInputValue(value);
>> }
>> [...]
>>
>> Now every input value is also stored in the FieldTrackings and
>> every validated FormField
>> is on the list, wether it stores an error or not.
>>
>> Is there a reason why this is not the "normal" behaviour of these
>> standard components?
>>
>> Christian
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-
>> help@jakarta.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Ivano <i....@mclink.it>.
My guess is that you won't need those fields unless you have some error
to show and you want to tell the user which field was wrong.
If this is the idea for the most common use of field validation, the
consequence is that you don't want to take note of unused data.
Ivano Pagano.
Christian Mittendorf wrote:
> Am 01.02.2006 um 01:56 schrieb Christian Mittendorf:
>
>> That might be a solution: do ValidPropertySelection and
>> ValidCheckbox record their input values to the ValidationDelegate in
>> any case, even if no error occured?
>
>
> Thanks for the hints!
>
> I've implemented both classes and added the following code:
>
> rotected void rewindFormComponent(IMarkupWriter writer, IRequestCycle
> cycle)
> {
> [...]
> IValidationDelegate delegate = getForm().getDelegate();
> if(delegate != null)
> {
> delegate.recordFieldInputValue(value);
> }
> [...]
>
> Now every input value is also stored in the FieldTrackings and every
> validated FormField
> is on the list, wether it stores an error or not.
>
> Is there a reason why this is not the "normal" behaviour of these
> standard components?
>
> Christian
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Ryan <cr...@gmail.com>.
Have you looked at IValidationDelegate? You can extend
ValidationDelegate and override methods such as writeSuffix to add
error messages around where the field is rendered. This will work out
of the box for the fields you mentioned that already support
validation. For checkboxes, radio, and list boxes you can create your
own components that support validation and work with this framework
(IMHO these should be part of the framework even if they are not the
common case just for consistency).
Ryan
On 2/1/06, Christian Mittendorf <ch...@freenet.de> wrote:
> Am 01.02.2006 um 01:56 schrieb Christian Mittendorf:
> > That might be a solution: do ValidPropertySelection and
> > ValidCheckbox record their input values to the ValidationDelegate
> > in any case, even if no error occured?
>
> Thanks for the hints!
>
> I've implemented both classes and added the following code:
>
> rotected void rewindFormComponent(IMarkupWriter writer, IRequestCycle
> cycle)
> {
> [...]
> IValidationDelegate delegate = getForm().getDelegate();
> if(delegate != null)
> {
> delegate.recordFieldInputValue(value);
> }
> [...]
>
> Now every input value is also stored in the FieldTrackings and every
> validated FormField
> is on the list, wether it stores an error or not.
>
> Is there a reason why this is not the "normal" behaviour of these
> standard components?
>
> Christian
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Christian Mittendorf <ch...@freenet.de>.
Am 01.02.2006 um 01:56 schrieb Christian Mittendorf:
> That might be a solution: do ValidPropertySelection and
> ValidCheckbox record their input values to the ValidationDelegate
> in any case, even if no error occured?
Thanks for the hints!
I've implemented both classes and added the following code:
rotected void rewindFormComponent(IMarkupWriter writer, IRequestCycle
cycle)
{
[...]
IValidationDelegate delegate = getForm().getDelegate();
if(delegate != null)
{
delegate.recordFieldInputValue(value);
}
[...]
Now every input value is also stored in the FieldTrackings and every
validated FormField
is on the list, wether it stores an error or not.
Is there a reason why this is not the "normal" behaviour of these
standard components?
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Christian Mittendorf <ch...@freenet.de>.
That might be a solution: do ValidPropertySelection and ValidCheckbox
record their input values to the ValidationDelegate in any case, even
if no error occured?
Am 01.02.2006 um 01:44 schrieb Daniel Lydiard:
> I was actually using the ValidPropertySelection and ValidCheckbox
> in my T3 code (http://issues.apache.org/bugzilla/show_bug.cgi?
> id=29535) and ported it over to T4. I basically took the existing
> T4 source for PropertySelection/Checkbox and added in the code to
> work with ValidationDelegate (by throwing ValidatorException in
> rewindFormComponent()). It was pretty straight forward.
>
> Is this what you were going for?
>
>
> ----- Original Message ----- From: "Christian Mittendorf"
> <ch...@freenet.de>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Tuesday, January 31, 2006 4:34 PM
> Subject: Re: Using fieldTrackings
>
>
>> Am 01.02.2006 um 01:20 schrieb Jesse Kuhnert:
>>
>>> Hmmm...I know the tapestry workbench demo application has a sample
>>> "ShowErrors" sort of component for this.
>>
>> Ok, I think I'll have to check it.
>>
>>> The biggest reason I suggested the ValidationDelegate approach is
>>> because
>>> you're guaranteed to get every fields value and error written out
>>> properly
>>> as everything is passed in as a paramter to you.
>>
>> Are you sure that this approach is also working with
>> PropertySelection or
>> Checkboxes?
>>
>> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Page structure best practices
Posted by Robert Zeigler <ro...@scazdl.org>.
People usually solve this by creating a "Border" component.
Search searching the mailing list for the Border component. :)
Incidentally, "including" something is normally done by making a
component in tapestry. :)
Robert
Alin Simionoiu wrote:
> Hi folks,
>
> I'm trying to build a small website that will exercise some business
> logic. I looked around for some framework that will help me build the
> pages fast.
> I choose Tapestry mainly because I can use the existing HTML pages as
> templates, really cool thing.
>
> The first thing that I did was buying "Enjoy Web Development with
> Tapestry" read the thing and start cranking the code.
> After two days of cranking I end up having the first problem,
> although I will have to say is more like a "what's the best practices
> for this".
>
> My pages will have a header, a left side navigation panel and the
> main page. The left navigation panel controls what page i'm
> displaying, I say standard stuff.
> My question is: how to I build the page Tapestry way?. I try at first
> to use frames. The navigation panel has a logout link and boom first
> problem. When I click on Logout I could not figure out how to go to
> main page and not just refresh the frame. Seems that only the left
> frame is loaded with the main page.
> Checking the mailing list archive I read that people are recommending
> to move away from frames. Ok let's move away from frames. And do what?
> I was thinking about some sort of include, I will put the left panel
> in a separate template and include it on all the other templates that
> needs it (like php smarty include). Again check the mailing list, and
> nope there's no include. There's RenderBlock but I'm not sure it is
> what i need and really don't want to repeat the same html block in
> all the pages, yak
>
> How do people solve this kind of problem?. what's the recommended
> way?. It seems to me that I would need to put the navigation panel in
> a component. Is this the right way, component?.
> Do I inject the panel html page into the main page using Block/
> RenderBlock?
>
>
>
> Cheers,
> Alin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Page structure best practices
Posted by Martin Strand <ma...@entcap.se>.
I assume you've started creating your own components?
If so, you can just create a "Border" component with a template like this:
[Border.html]
<html>
<body>
<ul>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
</ul>
<div jwcid="@RenderBody">
Page content will be inserted here
</div>
</body>
</html>
and then use that Border component in all your pages like this:
[Page.html]
<html jwcid="@Border">
<p>This will be inserted in the middle of your Border template, by that
RenderBody component.</p>
</html>
It's not quite the same as an include but it does the same job.
I think Kent mentioned this in his book.
--Martin
On Wed, 01 Feb 2006 02:18:40 +0100, Alin Simionoiu <al...@zivva.com> wrote:
> Hi folks,
>
> I'm trying to build a small website that will exercise some business
> logic. I looked around for some framework that will help me build the
> pages fast.
> I choose Tapestry mainly because I can use the existing HTML pages as
> templates, really cool thing.
>
> The first thing that I did was buying "Enjoy Web Development with
> Tapestry" read the thing and start cranking the code.
> After two days of cranking I end up having the first problem, although I
> will have to say is more like a "what's the best practices for this".
>
> My pages will have a header, a left side navigation panel and the main
> page. The left navigation panel controls what page i'm displaying, I say
> standard stuff.
> My question is: how to I build the page Tapestry way?. I try at first to
> use frames. The navigation panel has a logout link and boom first
> problem. When I click on Logout I could not figure out how to go to main
> page and not just refresh the frame. Seems that only the left frame is
> loaded with the main page.
> Checking the mailing list archive I read that people are recommending to
> move away from frames. Ok let's move away from frames. And do what?
> I was thinking about some sort of include, I will put the left panel in
> a separate template and include it on all the other templates that needs
> it (like php smarty include). Again check the mailing list, and nope
> there's no include. There's RenderBlock but I'm not sure it is what i
> need and really don't want to repeat the same html block in all the
> pages, yak
>
> How do people solve this kind of problem?. what's the recommended way?.
> It seems to me that I would need to put the navigation panel in a
> component. Is this the right way, component?.
> Do I inject the panel html page into the main page using Block/
> RenderBlock?
>
>
>
> Cheers,
> Alin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Page structure best practices
Posted by Alin Simionoiu <al...@zivva.com>.
Thank you for the quick response Chris (and Robert for another reply
to my email), I'll check the Border component stuff.
Really appreciate the code offer but let's see if I can figure it out
myself, if not I may impose again.
Alin
On Jan 31, 2006, at 8:27 PM, Chris Chiappone wrote:
> Yeah I would definatly go away from using frames these days. The page
> you describe is basically what I use for my applications. It consists
> of a Border component that has a header footer and then place holders
> for components such as a left nav bar or left login area depending on
> the sessions state. In the border you would also have a section with
> a @RenderBody that contains your "Pages". If you need more detail I
> can send some code.
>
> ~chris
>
> On 1/31/06, Alin Simionoiu <al...@zivva.com> wrote:
>> Hi folks,
>>
>> I'm trying to build a small website that will exercise some business
>> logic. I looked around for some framework that will help me build the
>> pages fast.
>> I choose Tapestry mainly because I can use the existing HTML pages as
>> templates, really cool thing.
>>
>> The first thing that I did was buying "Enjoy Web Development with
>> Tapestry" read the thing and start cranking the code.
>> After two days of cranking I end up having the first problem,
>> although I will have to say is more like a "what's the best practices
>> for this".
>>
>> My pages will have a header, a left side navigation panel and the
>> main page. The left navigation panel controls what page i'm
>> displaying, I say standard stuff.
>> My question is: how to I build the page Tapestry way?. I try at first
>> to use frames. The navigation panel has a logout link and boom first
>> problem. When I click on Logout I could not figure out how to go to
>> main page and not just refresh the frame. Seems that only the left
>> frame is loaded with the main page.
>> Checking the mailing list archive I read that people are recommending
>> to move away from frames. Ok let's move away from frames. And do
>> what?
>> I was thinking about some sort of include, I will put the left panel
>> in a separate template and include it on all the other templates that
>> needs it (like php smarty include). Again check the mailing list, and
>> nope there's no include. There's RenderBlock but I'm not sure it is
>> what i need and really don't want to repeat the same html block in
>> all the pages, yak
>>
>> How do people solve this kind of problem?. what's the recommended
>> way?. It seems to me that I would need to put the navigation panel in
>> a component. Is this the right way, component?.
>> Do I inject the panel html page into the main page using Block/
>> RenderBlock?
>>
>>
>>
>> Cheers,
>> Alin
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-
>> help@jakarta.apache.org
>>
>>
>
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
Alin Simionoiu
alin.simionoiu@zivva.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Page structure best practices
Posted by Chris Chiappone <ch...@gmail.com>.
Yeah I would definatly go away from using frames these days. The page
you describe is basically what I use for my applications. It consists
of a Border component that has a header footer and then place holders
for components such as a left nav bar or left login area depending on
the sessions state. In the border you would also have a section with
a @RenderBody that contains your "Pages". If you need more detail I
can send some code.
~chris
On 1/31/06, Alin Simionoiu <al...@zivva.com> wrote:
> Hi folks,
>
> I'm trying to build a small website that will exercise some business
> logic. I looked around for some framework that will help me build the
> pages fast.
> I choose Tapestry mainly because I can use the existing HTML pages as
> templates, really cool thing.
>
> The first thing that I did was buying "Enjoy Web Development with
> Tapestry" read the thing and start cranking the code.
> After two days of cranking I end up having the first problem,
> although I will have to say is more like a "what's the best practices
> for this".
>
> My pages will have a header, a left side navigation panel and the
> main page. The left navigation panel controls what page i'm
> displaying, I say standard stuff.
> My question is: how to I build the page Tapestry way?. I try at first
> to use frames. The navigation panel has a logout link and boom first
> problem. When I click on Logout I could not figure out how to go to
> main page and not just refresh the frame. Seems that only the left
> frame is loaded with the main page.
> Checking the mailing list archive I read that people are recommending
> to move away from frames. Ok let's move away from frames. And do what?
> I was thinking about some sort of include, I will put the left panel
> in a separate template and include it on all the other templates that
> needs it (like php smarty include). Again check the mailing list, and
> nope there's no include. There's RenderBlock but I'm not sure it is
> what i need and really don't want to repeat the same html block in
> all the pages, yak
>
> How do people solve this kind of problem?. what's the recommended
> way?. It seems to me that I would need to put the navigation panel in
> a component. Is this the right way, component?.
> Do I inject the panel html page into the main page using Block/
> RenderBlock?
>
>
>
> Cheers,
> Alin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
--
~chris
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: Page structure best practices
Posted by Steve Shucker <ss...@vmsinfo.com>.
I know a lot of people here hate frames, but sometimes they're useful so
I'll give you another option.
I'll sometimes create a Submit component with style="display:none;" so the
user can't see it. Then you can use javascript to get a handle to the
button and call it's click() function. I've got a webapp with the
navigation in an iframe. When a user does something that requires changes
in the navigation, I make a javascript call to postback from there.
Alternatively, here's some javascript I have lying around to force a page to
the top window:
function CheckNesting() {
var prevParent = window
var parentWin = parent
while (parentWin != null && parentWin != prevParent) {
// use host for comparison because homepage is accessible
from multiple hrefs
if (parentWin.location.host == window.location.host) {
parentWin.location.href = window.location.href //
refresh parent
return
}
prevParent = parentWin
parentWin = parentWin.parent
}
}
It'll still let your page be nested in some other site's frames, but not in
any frames on your own site (remove location.host comparison to change this
behavior).
-Steve
-----Original Message-----
From: Alin Simionoiu [mailto:alin@zivva.com]
Sent: Tuesday, January 31, 2006 6:19 PM
To: Tapestry users
Subject: Page structure best practices
Hi folks,
I'm trying to build a small website that will exercise some business
logic. I looked around for some framework that will help me build the
pages fast.
I choose Tapestry mainly because I can use the existing HTML pages as
templates, really cool thing.
The first thing that I did was buying "Enjoy Web Development with
Tapestry" read the thing and start cranking the code.
After two days of cranking I end up having the first problem,
although I will have to say is more like a "what's the best practices
for this".
My pages will have a header, a left side navigation panel and the
main page. The left navigation panel controls what page i'm
displaying, I say standard stuff.
My question is: how to I build the page Tapestry way?. I try at first
to use frames. The navigation panel has a logout link and boom first
problem. When I click on Logout I could not figure out how to go to
main page and not just refresh the frame. Seems that only the left
frame is loaded with the main page.
Checking the mailing list archive I read that people are recommending
to move away from frames. Ok let's move away from frames. And do what?
I was thinking about some sort of include, I will put the left panel
in a separate template and include it on all the other templates that
needs it (like php smarty include). Again check the mailing list, and
nope there's no include. There's RenderBlock but I'm not sure it is
what i need and really don't want to repeat the same html block in
all the pages, yak
How do people solve this kind of problem?. what's the recommended
way?. It seems to me that I would need to put the navigation panel in
a component. Is this the right way, component?.
Do I inject the panel html page into the main page using Block/
RenderBlock?
Cheers,
Alin
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Page structure best practices
Posted by Alin Simionoiu <al...@zivva.com>.
Hi folks,
I'm trying to build a small website that will exercise some business
logic. I looked around for some framework that will help me build the
pages fast.
I choose Tapestry mainly because I can use the existing HTML pages as
templates, really cool thing.
The first thing that I did was buying "Enjoy Web Development with
Tapestry" read the thing and start cranking the code.
After two days of cranking I end up having the first problem,
although I will have to say is more like a "what's the best practices
for this".
My pages will have a header, a left side navigation panel and the
main page. The left navigation panel controls what page i'm
displaying, I say standard stuff.
My question is: how to I build the page Tapestry way?. I try at first
to use frames. The navigation panel has a logout link and boom first
problem. When I click on Logout I could not figure out how to go to
main page and not just refresh the frame. Seems that only the left
frame is loaded with the main page.
Checking the mailing list archive I read that people are recommending
to move away from frames. Ok let's move away from frames. And do what?
I was thinking about some sort of include, I will put the left panel
in a separate template and include it on all the other templates that
needs it (like php smarty include). Again check the mailing list, and
nope there's no include. There's RenderBlock but I'm not sure it is
what i need and really don't want to repeat the same html block in
all the pages, yak
How do people solve this kind of problem?. what's the recommended
way?. It seems to me that I would need to put the navigation panel in
a component. Is this the right way, component?.
Do I inject the panel html page into the main page using Block/
RenderBlock?
Cheers,
Alin
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Daniel Lydiard <dl...@hotmail.com>.
I was actually using the ValidPropertySelection and ValidCheckbox in my T3
code (http://issues.apache.org/bugzilla/show_bug.cgi?id=29535) and ported it
over to T4. I basically took the existing T4 source for
PropertySelection/Checkbox and added in the code to work with
ValidationDelegate (by throwing ValidatorException in
rewindFormComponent()). It was pretty straight forward.
Is this what you were going for?
----- Original Message -----
From: "Christian Mittendorf" <ch...@freenet.de>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, January 31, 2006 4:34 PM
Subject: Re: Using fieldTrackings
> Am 01.02.2006 um 01:20 schrieb Jesse Kuhnert:
>
>> Hmmm...I know the tapestry workbench demo application has a sample
>> "ShowErrors" sort of component for this.
>
> Ok, I think I'll have to check it.
>
>> The biggest reason I suggested the ValidationDelegate approach is
>> because
>> you're guaranteed to get every fields value and error written out
>> properly
>> as everything is passed in as a paramter to you.
>
> Are you sure that this approach is also working with
> PropertySelection or
> Checkboxes?
>
> Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Christian Mittendorf <ch...@freenet.de>.
Am 01.02.2006 um 01:20 schrieb Jesse Kuhnert:
> Hmmm...I know the tapestry workbench demo application has a sample
> "ShowErrors" sort of component for this.
Ok, I think I'll have to check it.
> The biggest reason I suggested the ValidationDelegate approach is
> because
> you're guaranteed to get every fields value and error written out
> properly
> as everything is passed in as a paramter to you.
Are you sure that this approach is also working with
PropertySelection or
Checkboxes?
Christian
Re: Using fieldTrackings
Posted by Christian Mittendorf <ch...@freenet.de>.
Am 01.02.2006 um 01:20 schrieb Jesse Kuhnert:
> Hmmm...I know the tapestry workbench demo application has a sample
> "ShowErrors" sort of component for this.
>
> The biggest reason I suggested the ValidationDelegate approach is
> because
> you're guaranteed to get every fields value and error written out
> properly
> as everything is passed in as a paramter to you.
>
> I'm not as familiar with your method, but maybe the workbench? ...
http://demo.raibledesigns.com/workbench/app
No, it's not. The WorkBench does display errors markers for all
fields, but it will only
display the first error message (pretty bad usability, by the way :-).
Of course, you can extend the error area to display all messages. But
then again,
the error messages are outside the form and my goal is to display the
error message
next to the input field where the error occurs.
Christian
Re: Using fieldTrackings
Posted by Jesse Kuhnert <jk...@gmail.com>.
Hmmm...I know the tapestry workbench demo application has a sample
"ShowErrors" sort of component for this.
The biggest reason I suggested the ValidationDelegate approach is because
you're guaranteed to get every fields value and error written out properly
as everything is passed in as a paramter to you.
I'm not as familiar with your method, but maybe the workbench? ...
On 1/31/06, Christian Mittendorf <ch...@freenet.de> wrote:
>
> Error tracking is working really nice, that is not the problem. My
> problem is that not every form field does record its input value to
> the trackingFields. Textfields do always record their values, even if
> no error occured.
>
> On my page I'm iterating the trackingFields while I'm building up the
> form with all its form fields. In code it does almost look like this:
>
> <form>
> <fieldTracking.iterator...>
> <errorField.next>
> <inputField>
> <errorField.next>
> <inputField>
> <submit>
> </form>
>
> And it's working fine - as long as all your input fields are
> TextFields/DatePicker/TextArea. All error messages are shown close to
> their related input fields.
>
> But if you change a TextField to a PropertySelection or a Checkbox,
> this model is no longer working.
>
> The list of entries does not match the number of form components
> inside the form, as these form components do not record their input
> values to the fieldTrackings. These fields do only record their error
> message to the fieldTrackings.
>
> Any idea on how to display the error messages as in my example?
>
> Christian
>
>
> Am 01.02.2006 um 00:44 schrieb Ron Piterman:
>
> > I don't know why checkbox propertySelection aso don't have
> > validator, I guess they are not that common, but you can validate
> > them in your submit/form listener and add trackings to the
> > delegate, making the errors apear on each IFormComponent...
> >
> > you just call one of the error tracking methods on the delegate.
> > make sure you use one that needs a IFormComponent as parameter, and
> > your error will be recorded for this field.
> > Also, you can record errors for fields which have validators if you
> > perform some extra validation which is not done by the validator,
> > like consistency etc.
> >
> > Hope that helps,
> >
> > Cheers,
> > Ron
> >
> > Christian Mittendorf wrote:
> >> Hello!
> >> I'm currently exploring how Tapestry 4 is validating fields and
> >> tracking error messages.
> >> Can someone please tell me if I'm right with the following
> >> assumptions:
> >> - _every_ error is tracked in the ValidationDelegates fieldTrackings
> >> - _only_ the content of form elements that extend ValidField or
> >> implement TranslatedField is stored in FieldTrackings
> >> Therefore only the following form elements will always be
> >> available from the fieldTrackings, even if no error was recorded
> >> for them:
> >> - DatePicker, TextArea, TextField (they implement TranslatedField)
> >> - ValidField (as of Tapestry 4 deprecated)
> >> This does lead me to the following question: why isn't the input
> >> of other form elements (like i.e. Checkbox, PropertySelection)
> >> handled the same way as TranslatedFields are?
> >> Isn't this behavior contrary to the documentation of
> >> IValidationDelegates method "recordFieldInputValue()". The
> >> JavaDocs say:
> >> "Records the user's input for the current form component. Input
> >> should be recorded even if
> >> there isn't an explicit error, since later form-wide validations
> >> may discover an error in the
> >> field."
> >> What I want to do is to show error messages from the form
> >> delegate next to the form field (text field, check box, drop
> >> down, etc) where the error is recorded. Is there a known way to
> >> do it?
> >> Christian
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tapestry-user-
> >> help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
Re: Using fieldTrackings
Posted by Christian Mittendorf <ch...@freenet.de>.
Error tracking is working really nice, that is not the problem. My
problem is that not every form field does record its input value to
the trackingFields. Textfields do always record their values, even if
no error occured.
On my page I'm iterating the trackingFields while I'm building up the
form with all its form fields. In code it does almost look like this:
<form>
<fieldTracking.iterator...>
<errorField.next>
<inputField>
<errorField.next>
<inputField>
<submit>
</form>
And it's working fine - as long as all your input fields are
TextFields/DatePicker/TextArea. All error messages are shown close to
their related input fields.
But if you change a TextField to a PropertySelection or a Checkbox,
this model is no longer working.
The list of entries does not match the number of form components
inside the form, as these form components do not record their input
values to the fieldTrackings. These fields do only record their error
message to the fieldTrackings.
Any idea on how to display the error messages as in my example?
Christian
Am 01.02.2006 um 00:44 schrieb Ron Piterman:
> I don't know why checkbox propertySelection aso don't have
> validator, I guess they are not that common, but you can validate
> them in your submit/form listener and add trackings to the
> delegate, making the errors apear on each IFormComponent...
>
> you just call one of the error tracking methods on the delegate.
> make sure you use one that needs a IFormComponent as parameter, and
> your error will be recorded for this field.
> Also, you can record errors for fields which have validators if you
> perform some extra validation which is not done by the validator,
> like consistency etc.
>
> Hope that helps,
>
> Cheers,
> Ron
>
> Christian Mittendorf wrote:
>> Hello!
>> I'm currently exploring how Tapestry 4 is validating fields and
>> tracking error messages.
>> Can someone please tell me if I'm right with the following
>> assumptions:
>> - _every_ error is tracked in the ValidationDelegates fieldTrackings
>> - _only_ the content of form elements that extend ValidField or
>> implement TranslatedField is stored in FieldTrackings
>> Therefore only the following form elements will always be
>> available from the fieldTrackings, even if no error was recorded
>> for them:
>> - DatePicker, TextArea, TextField (they implement TranslatedField)
>> - ValidField (as of Tapestry 4 deprecated)
>> This does lead me to the following question: why isn't the input
>> of other form elements (like i.e. Checkbox, PropertySelection)
>> handled the same way as TranslatedFields are?
>> Isn't this behavior contrary to the documentation of
>> IValidationDelegates method "recordFieldInputValue()". The
>> JavaDocs say:
>> "Records the user's input for the current form component. Input
>> should be recorded even if
>> there isn't an explicit error, since later form-wide validations
>> may discover an error in the
>> field."
>> What I want to do is to show error messages from the form
>> delegate next to the form field (text field, check box, drop
>> down, etc) where the error is recorded. Is there a known way to
>> do it?
>> Christian
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-
>> help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Ron Piterman <rp...@gmx.net>.
I don't know why checkbox propertySelection aso don't have validator, I
guess they are not that common, but you can validate them in your
submit/form listener and add trackings to the delegate, making the
errors apear on each IFormComponent...
you just call one of the error tracking methods on the delegate. make
sure you use one that needs a IFormComponent as parameter, and your
error will be recorded for this field.
Also, you can record errors for fields which have validators if you
perform some extra validation which is not done by the validator, like
consistency etc.
Hope that helps,
Cheers,
Ron
Christian Mittendorf wrote:
> Hello!
>
> I'm currently exploring how Tapestry 4 is validating fields and
> tracking error messages.
>
> Can someone please tell me if I'm right with the following assumptions:
>
> - _every_ error is tracked in the ValidationDelegates fieldTrackings
>
> - _only_ the content of form elements that extend ValidField or
> implement TranslatedField is stored in FieldTrackings
>
> Therefore only the following form elements will always be available
> from the fieldTrackings, even if no error was recorded for them:
>
> - DatePicker, TextArea, TextField (they implement TranslatedField)
> - ValidField (as of Tapestry 4 deprecated)
>
> This does lead me to the following question: why isn't the input of
> other form elements (like i.e. Checkbox, PropertySelection) handled the
> same way as TranslatedFields are?
>
> Isn't this behavior contrary to the documentation of
> IValidationDelegates method "recordFieldInputValue()". The JavaDocs say:
>
> "Records the user's input for the current form component. Input should
> be recorded even if
> there isn't an explicit error, since later form-wide validations may
> discover an error in the
> field."
>
> What I want to do is to show error messages from the form delegate next
> to the form field (text field, check box, drop down, etc) where the
> error is recorded. Is there a known way to do it?
>
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using fieldTrackings
Posted by Christian Mittendorf <ch...@freenet.de>.
Am 01.02.2006 um 01:06 schrieb Jesse Kuhnert:
> If you wanted to display error messages next to the fields in
> question I
> would highly reccomend looking at this (though it uses labels, you can
> override whichever method points you want):
>
> http://jakarta.apache.org/tapestry/UsersGuide/
> validation.html#validation.delegate
Thanks, I already looked into it. And it's not going to work with the
layout templates that I got from the the design department as well as
the
ideas of the product management. My solution must be based upon
independent fields.
Christian
Re: Using fieldTrackings
Posted by Jesse Kuhnert <jk...@gmail.com>.
If you wanted to display error messages next to the fields in question I
would highly reccomend looking at this (though it uses labels, you can
override whichever method points you want):
http://jakarta.apache.org/tapestry/UsersGuide/validation.html#validation.delegate
On 1/31/06, Christian Mittendorf <ch...@freenet.de> wrote:
>
> Hello!
>
> I'm currently exploring how Tapestry 4 is validating fields and
> tracking error messages.
>
> Can someone please tell me if I'm right with the following assumptions:
>
> - _every_ error is tracked in the ValidationDelegates fieldTrackings
>
> - _only_ the content of form elements that extend ValidField or
> implement TranslatedField is stored in FieldTrackings
>
> Therefore only the following form elements will always be available
> from the fieldTrackings, even if no error was recorded for them:
>
> - DatePicker, TextArea, TextField (they implement TranslatedField)
> - ValidField (as of Tapestry 4 deprecated)
>
> This does lead me to the following question: why isn't the input of
> other form elements (like i.e. Checkbox, PropertySelection) handled
> the same way as TranslatedFields are?
>
> Isn't this behavior contrary to the documentation of
> IValidationDelegates method "recordFieldInputValue()". The JavaDocs say:
>
> "Records the user's input for the current form component. Input
> should be recorded even if
> there isn't an explicit error, since later form-wide validations may
> discover an error in the
> field."
>
> What I want to do is to show error messages from the form delegate
> next to the form field (text field, check box, drop down, etc) where
> the error is recorded. Is there a known way to do it?
>
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>