From: <[EMAIL PROTECTED]>
> In regular HTML checkbox, the value of the checkbox can practically be
> anything. Does the struts html:checkbox limit us to just yes/true/on
> values?

No, you can have anything you want as the value.  It might default to yes or
true, I haven't tried it.

> If I have a list of records that I get from the database and I want to
> display it with a checkbox at the left, the value of the checkbox being
> the id of the record, how do I do that?

Use the 'value' attribute of the <html:checkbox> tag, then if the box is
checked, that value will be submitted as the value of the form element.

(Checkboxes are special-- only successful/checked ones will be submitted, so
read the docs and reset them properly or you'll never be able to UNcheck
them.)

> Also how does the multibox fall into the picture? Can I use checkbox and
> multibox interchangeably?

No... checkbox is a single thing, and corresponds to a String property in
your Form bean.  Multibox corresponds to a String[], because you can choose
more than one item.  Here's an example of multibox:

    <c:forEach items="${accountMap}" var="item" >
       <html-el:multibox property="accounts" value="${item.key}"/>
       <c:out value="${item.key}"/> &nbsp;
       <c:out value="${item.value.costCenterDesc}"/> <br/>
    </c:forEach>

Technically, I suppose you could use multibox in place of checkbox, but if
you're expecting multiple values, checkbox won't work, you'll only ever see
the final value that the browser submitted.

HTH,
-- 
Wendy Smoak


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

Reply via email to