I am doing my first project with Turbine, and Intake is giving me hell, but
I think I get it now, but anyway judge for yourself from this question :-

If I am displaying an invoice and invoice lines on a single page, and
allowing enterable fields throughout, I may do something like :-

#foreach ( $line in $invoice.getLines() )
    #set $lineGroup = $intake.get( "InvoiceLine", $line.lineNo )

    #if ( !$redisplay )
        $lineGroup.init($line)
    #end

    #textfield ( $LineGroup.ProdCode.Key $LineGroup.ProdCode )
    #showError ( $LineGroup.ProdCode.isValid()
$LineGroup.ProdCode.getMessage() )
    ...etc
#end


I only set $redisplay in the preceding action (if there has been one) if
validation fails, so they see their data unchanged. On the first visit to
the screen the groups are all initialized, as redisplay is not there.

But I would really like to get rid of 'redisplay' and put:-

#if ( !$lineGroup.isInitialized() )

this would tell me if the group had been constructed from parameters or just
plucked from the pool or whatever.
.
This has the advantage that if a new invoice line has been added by user B,
whilst user A was slowly entering some invalid data, then the new line would
appear and be displayed correctly
together with the invalid lines, and their error messages.

Is it possible to perform such as test?

I thought of maybe writing a macro that first tried an  $intake.get(
"InvoiceLine", $line.lineNo, false ) and if the result was null, then set a
flag and then  $intake.get( "InvoiceLine", $line.lineNo, true ) to return
the group. Maybe I could pass in the name of the flag to the macro ....?

Anyway, any advice would be much appreciated.

N


--
To unsubscribe, e-mail:   <mailto:turbine-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-user-help@;jakarta.apache.org>

Reply via email to