cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastien Arbogast <sebastien.arbog...@gmail.com>
Subject Re: Object list form ?
Date Mon, 02 May 2005 15:14:27 GMT
> I'm not sure what you mean by 'list' here. Is it a drop-down listbox as
> in the HTML <select> element?

Ok you're right I should have precised. In fact what I want to display
is something like the list of email messages in Google, in a table,
with a checkbox for each line (to select items to apply actions on)
and just a few details about the item so that I can edit it. For
example I would like to obtain some HTML code like this at the end :

<form action="..." method="post">
  <table>
    <tr>
      <td><input type="checkbox" id="user_select[1]"/></td>
      <td><a href="edit_user_1">User1</a></td>
    </tr>
    <tr>
      <td><input type="checkbox" id="user_select[2]"/></td>
      <td><a href="edit_user_2">User2</a></td>
    </tr>
    ...
    <tr>
       <td colspan="2"><input type="submit"/></td>
  </table>
</form>

And my problem is that 
1 - I don't know the number of lines in the table before I load the user list
2 - I don't know how to populate the form with the right information
(eg to put user names instead of "UserN")

As you may have guessed I need that for some backend application to
manage a set of users.

> > In other words I would like to :
> > 1 - get the list of value object from Spring layer
> > 2 - build my form model (of which I don't know the size 'a priori')
> > 3 - populate my model with data from the value objects in the list
> > 4 - display the form
> >
> > It's the dynamic model and the data binding aspects that make me
> > uncomfortable above all.
> 
> Assuming your value objects are defined somewhat like:
> 
> public class Item {
>    public String getKey();
>    public String getValue();
> }
> 
> Then your flowscript code should be liike:
> 
> var aList = getTheList(); // via Spring, returns a List of Item's
> form.lookupWidget("theSelectField").setSelectionList(aList, "key",
> "value");

Anyway this is very useful and I'm sure I will need it somewhere further.

-- 
Sebastien ARBOGAST

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


Mime
View raw message