Login  Register

Re: Generating table cells based on a "columns" attribute

Posted by Alessandro Vernet on Oct 27, 2009; 1:58am
URL: https://discuss.orbeon.com/Generating-table-cells-based-on-a-columns-attribute-tp277051p277112.html

Ethan,

On Mon, Oct 26, 2009 at 11:40 AM, Ethan Gruber <[hidden email]> wrote:
> For example, I would like to create an "Add Row" trigger that inserts a
> <row> into <tbody>.  If I define @cols as 4, I'd like "Add Row" to insert
> <row><entry/><entry/><entry/><entry/></row>, with an input for each <entry/>

It looks like you need a way to execute an action a given number of
times. In pseudo-code, you could do something like:

<xforms:action xxforms:iterate="for $i in 1 to tgroup/@cols return
xxforms:element('dummy')">
    <xforms:insert context="row" origin="xxforms:element('entry')"/>
</xforms:action>

The 1 to tgroup/@cols returns a sequence of (1, 2, 3, 4) if you have 4
columns, and the xxforms:element() creates an element for each one, as
the context for XPath evaluation is expected to be a node.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet