cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Access cform field labels from flowscript
Date Thu, 05 Jan 2006 11:25:35 GMT
Since you want an overview of the filled form, why not do something like:

1) call a pipeline from flow with params holding the widgetids:widgetvalues
2) generates a cocoon:/pipeline with the jx generator (see the cocoon:/pipeline below)
3) You now have an xml block having the translated labels and the corresponding widgetvalues



The cocoon:/pipeline could look like below

1) generates the form definition 
2) do your i18n transformer
3) Do an xsl outputting something like
	<field>
		<label>translated text</label>
		<postedfield>${username}</postedfield>
	<field>


Think this is all (though, admit it is quite dirty :-) )

AS


H

> 
> 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
> 
> 

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


Mime
View raw message