You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by ext-ml <ex...@oeamtc.at> on 2006/01/05 11:25:18 UTC

Access cform field labels from flowscript

Hi,

We have the following use case and I would like to know, if there is a
recommended solution for this:

We are developing a generic form framework based on cform which should
roughly use the following workflow:
1. Display input forms until successfully validated (can be single-page as
well as multip-page froms)
2. Display a summary page with all the entered information to be confirmed
by the user
3. Process data as follows:
   - Store entered data in database
   - Send mail to an employee who works with the form data
   - Send mail to user with summary of entered data
4. Display a summary page with all entered information, success status and
print option

Now we are using the following snippet to specify the 18n-able labels in the
form definition:
<fd:field id="username">
  <fd:label><i18n:text key="forms.username"/></fd:label>
  <fd:datatype base="string"/>
</fd:field>

Forms are correctly displayed and validated and everything for the 1st step
is fine.

But for the steps 2-4 I'm using flowscript and JXTemplates to display the
summary page and plain flowscript to generate the mail content.
How can I access the field lables from within flowscript, so that I can
generate a generic mail message in the following format:
<Label of field1>: <Value of field1>
<Label of field2>: <Value of field2>
... where the labels are correctly translated?

There are two challenges:

1. How to get at the label definition from within flowscript?
Here I'm missing a getLabel() method in the WidgetDefinition interface.
The only thing I found was generateDisplayData() and generateLabel() but
they deal with SAX events.

2. How to translate the labels within flowscript?
If I managed the 1st challange I will only get the i18n:text element with
the key.
Since there is no i18n-Transformer involved in generating the mail content,
I have to translate it manually.
Is it possible to reuse the configured catalogs of the i18n-transformer from
flow and let it translate strings?

Additionally I'd like to hear about other solutions which might do the same
(I thought about generating the mails via pipelines with i18n-transformer
included - but I'm unsure, if this is the way to go).

Thanks for any hints,

Andreas Hochsteger

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org