When the Form is successfully submitted, i want to return my component but with a different view of the data where there is no Form so my success event handler returns the component itself (by returning 'this') but with a different view. And as i said before, despite the generation of 2 zones, it works. My question is more on the choice that has been made on the Form component to manage zones. I don't understand why the Form component is not able to manage an englobing zone as the Link component does ... I don't like the fact that it has its own behavior. IMHO all components should manage the zones in the same way ... Does the Form component need its own zone internally in Tapestry ?

Stephane

Howard Lewis Ship a écrit :
What is being returned from your form's success event handler?

You want to return a Block that contains your Form.

You could even return the Form itself.

If you return the Zone, it renders its <div> and then its content.

In 5.0.15-SNAPSHOT you could return the zone's body property.

On Thu, Sep 11, 2008 at 2:19 AM, Webmaster Bébé Nounou
<[EMAIL PROTECTED]> wrote:
I would like to get your thoughts about the necessity for the form component
to output its own Zone when one already exists ...

I work on a component wish should be able to show the user a piece of data
(an article) but with different views according to the use case :
- The user can read an extract of the article,
- The user can read the whole article,
- The user can edit/create the article.
The idea is to permit the user to switch from one view to the other without
rerendering the whole page (which show a list of articles) using Tapestry
Ajax possibilities.

So i started by putting all the output of the article in a global zone
called ArticleZone with Links (where the zone parameter is set to the
ArticleZone) to switch between the views.

<t:zone t:id="ArticleZone">
  <t:delegate to="view"/>
</t:zone>

<t:block id="ResumeView">
  <t:eventlink t:event="detail" t:zone="ArticleZone">Detail</t:eventlink>
  ...
</t:block>

<t:block id="DetailView">
  <t:eventlink t:event="resume" t:zone="ArticleZone">Resume</t:eventlink>
  ...
</t:block>

All that stuff works fine.

The problem raises up with the edit view. In this view, the data is shown in
a Form and i just set the zone parameter of the form to the ArticleZone (as
i did with the links).

<t:block id="EditView">
  <t:form t:id="articleForm" t:zone="ArticleZone">
      ...
  </t:form>
</t:block>

I thought that the ArticleZone would be rerendered when the submit is
triggered and for the end user, it looks like it is done. But if one look at
the HTML code rendered to the client, he can see that Tapestry rendered 2
Zones ! The ArticleZone and a second ArticleZone (renamed by the framework
to avoid the duplication of the name) for the Form to use ...

<div id="ArticleZone" class="t-zone">
  <div id="ArticleZone:11c50af13af" class="t-zone">
      <form id="articleForm:11c50af13af" name="articleForm:11c50af13af"
method="post" action="/backoffice/testad.adbloc.articleform">
        ...
      </form>
  </div>
</div>

So why doesn't Tapestry use the existing Zone when this one already exists
like Links do ... (and creates the Zone defined in the zone parameter of the
Form only if this one doesn't exist) ?

Stephane





Reply via email to