based on

<component id="tickbox" type="CheckBox">
  <binding name="value" value="currentAttendance.attended"/>
</component>

when you submit, then the value from the check box will be automatically
inserted into currentAttendance.attended - you don't need to do anything.

if you don't want to change the datatype of the Attendance domain objects,
then you can just have the following methods on your attendance class:

boolean isAttended()
setIsAttended(boolean)

which can behave as a bridge between the checkbox and the underlying
Attendance domain methods.

You can also use translators to bridge this, i don't have a ready example.

Another alternative is to use InvokeListener on the Page to be able to
reassemble your attendance object before the submit method on the page gets
called.

As you can see there are many ways to do it.  I'm in the middle of something
so can't explain more elaborately as this point, but if you get stuck
further will be happy to help in the next day or two.

On 8/18/06, zqzuk <[EMAIL PROTECTED]> wrote:


hi, thanks for prompt reply,

"then you just need to bind the checkbox value to a
currentAttendance.persentognl"

sorry could you be more specific about this please? i still dont quite
understand. like this?


<property name="currentAttendance"/>
<component id="attendances" type="For">
    <binding name="source" value="attendances"/>
    <binding name="value" value="currentAttendance"/>
    <binding name="element" value="literal:tr"/>
</component>
<component id="student" type="Insert">
    <binding name="value" value="currentAttendance.student.name"/>
</component>
<component id="classname" type="Insert">
    <binding name="value" value="currentAttendance.classname"/>
</component>
<component id="tickbox" type="CheckBox">
    <binding name="value" value="currentAttendance.attended"/>
</component>


then i suppose i need to change Attendance.attended to boolean type?

also, when SAVE is clicked, how can i update each object? would it be:

for each(element in getAttendances()){
    getCurrentAttendance().set......   // but how can i get the variable
values of each attendance
}

thanks alot!







karthik.nar wrote:
>
> you should ensure that the Attendance list provided to the For loop is
> exactly the same both during render and rewind.
>
> then, irrespective of the number of rows the render/rewind sequence will
> be
> exactly the same.
>
> so the checkbox  on render will correspond to the same Attendance object
> when the rewind happens.
>
> then you just need to bind the checkbox value to a
> currentAttendance.persentognl
>
>
> On 8/18/06, zqzuk <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hi, the scenario is that i have a collection of Attendance objects- for
>> example, Attendance(Student s, String class, String attended) - to be
>> displayed on a page. and i would like a checkbox (or other components
>> whichever appropriate) for each row. so if the student attended the
>> class,
>> user can tick the box. user then ticks those boxes if the student
>> attended
>> the class, then finally click a button "save", and program will figure
>> out
>> which Attendance objects are changed and commit database transactions.
>>
>> so something like this:
>>
>> -----------------------------------------------------------------------
>> Student                   class                     attended
>> -----------------------------------------------------------------------
>> Bob                         math                       ticked
>> Henry                      physics                    ticked
>> Anne                       english                    ticked
>> Nick                         history                     unticked
>>
>> [Save Button]
>> ----------------------------------------------------------------------
>>
>> each row above represents an Attendance object. the problem is, because
>> the
>> number of rows are variant, so i m using a For component to produce
these
>> rows automatcally. but how can i know which checkboxex are ticked, and
>> which
>> checkbox is for which row? as these boxex are produced at runtime and
>> assigned different names at runtime isnt it? unlike the DirectLink
>> component
>> which can pass parameters such as the object's id, how does a checkbox
>> (or
>> if other appropriate components) identify the row?
>>
>> i could use directlink instead and open up another window where user
tick
>> the box in a separate page for each Attendance row, but that would be
bad
>> design...
>>
>> any suggestions pleaes, thanks very much!
>> --
>> View this message in context:
>>
http://www.nabble.com/hi%2C-is-it-possible-to-do-this-with-tapestry...-tf2126696.html#a5867937
>> Sent from the Tapestry - User forum at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> --
> Thanks, Karthik
>
>

--
View this message in context:
http://www.nabble.com/hi%2C-is-it-possible-to-do-this-with-tapestry...-tf2126696.html#a5868510
Sent from the Tapestry - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Thanks, Karthik

Reply via email to