Bob was right.

Indeed, in a first version of my app, I used the checkboxes to post the form
as bob suggested.
IT worked quite well, but I wanted a more standard design after all.

So, I finally did a simple form with all checkboxes in one form, and
"hidable/showable labels" to give details about each item.
I think I found an interesting way to do it : using a map<String, Boolean>
to hold the information of which item is clicked.
In this pattern, each checkbox has a generated name  of the form
"checkbox-<id>" where id is the id of the item.

This way, I can use form.copyTo( myMap<String, Boolean> ) to get all the
values of the checkboxes, then I can loop through my items,
and add them to my order list if map.get( "checkbox-"+item.getID() ) is
true.

It often happens that we have these kind of stuff to do in a webv
application, pick items from a list. The only alternative is the pick list
from click.
So I think this pattern could be quite interesting to add to the click
examples : shopping cart and summary of orders.

Thanks all for your help,
 Stéphane


2011/4/18 Bob Schellink <[email protected]>

> There are many ways but since you quoted JSP you can use Velocity to do the
> same thing.
>
> However in HTML you cannot use a GET to perform a POST without using JS.
>
> regards
>
> Bob
>
> On 2011/04/18 16:52 PM, Gilberto wrote:
>
>>  21.                  %>
>>  22. <p:forEach items="${list}" var="product">
>>  23. <tr>
>>  24. <td>
>>  25. <input type="checkbox" name="chec1k">
>>  26. </td>
>>  27. <td>
>>  28. <p:out value="${product.pcode}"></p:out>
>>  29.
>>  30. </td>
>>  31.
>>  32. <td>
>>  33. <p:out value="${product.pname}"></p:out>
>>  34. </td>
>>  35.
>>  36. <td>
>>  37. <p:out value="${product.qty}"></p:out>
>>  38. </td>
>>  39. </tr>
>>  40. </p:forEach>
>>  41. <input type="submit" value="Add To Cart">
>>  42. </table>
>>  43. </form>
>>
>>
>>
>> </quote>
>>
>> How could we build something like that with Click?
>>
>> Regards,
>>
>> Gilberto
>>
>> [1]http://dl.dropbox.com/u/9093640/tela_01_vinculao.png
>>
>>
>>
>>
>

Reply via email to