Kamal Bhatt wrote:
>
> Hi
> We have a form that is bound to a java object (so we can copy it to a
> db). There is a need for a "preview" button. The idea behind this would
> be to take the form as xml data (as opposed to the database), reprocess
> it (with an existing XSLT) and open the product of this in another screen..
>
> Currently, we are considering the use of jx templates, but this means
> replicating code. I was wondering if there was a way of taking the form,
> convert it into XML (perhaps with the XMLAdapter), pass this XML data
> back to the sitemap (without destroying the state of the current form)
> and eventually pass it to an XSLT to process the form in a separate window.
Trying to understand exactly what you want here... you want the Preview
button to display the preview in a separate window? This can be done
with client-side javascript, but can get tricky.
> I was thinking about creating an action in the form definition which
> would call a function like this (Note, I have not tested the following
> code):
You probably want to make sure that the form is successfully validated
first, which means using fd:submit. This also makes opening the preview
in a new window difficult, since you don't know beforehand if the
validation will be successful (open a new window) or not (redisplay the
form w/errors in the same window).
I implemented a similar Preview function just recently, but it displays
the preview in the same window as the form (actually inline on the same
page as the form).
> cocoon.sendPage("preview-pipeline", {xml : form.getXML().toString()});
>
> but then what?
If it's just a question of how to get the contents of the "xml" member
streamed into a pipeline's generator, you can do that via the module source:
<map:match pattern="preview-pipeline">
<map:generate src="module:flow-attr:xml" />
<map:transform ... />
<map:serialize />
</map:match>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]