5 Replies Latest reply on Oct 11, 2007 10:54 AM by pmuir

    <h:selectBooleanCheckbox>

    kannattaa

      I have <h:selectBooleanCheckbox value="true" /> inside and outside of the loop. The property "value" isn't rendered inside the loop but when it is outside, everything is ok.
      what is the problem in?

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:ui="http://java.sun.com/jsf/facelets">
       <head>
       <title></title>
       </head>
       <body>
       <h:form>
       <h:selectBooleanCheckbox value="true" />
       <ui:repeat value="#{testListCommodities.commodities}" var="currentCommodity">
       <h:selectBooleanCheckbox value="true" />
       </ui:repeat>
       </h:form>
       </body>
      </html>


      Resulted Html :
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
      <html xmlns="http://www.w3.org/1999/xhtml">
       <head>
       <title></title>
       </head>
       <body>
      <form id="j_id2" name="j_id2" method="post" action="/mageric-start-web/test/test.seam" enctype="application/x-www-form-urlencoded">
      <input type="hidden" name="j_id2" value="j_id2" />
      
      <input type="checkbox" name="j_id2:j_id3" checked="checked" />
      
      <input type="checkbox" name="j_id2:j_id4:0:j_id5" />
      <input type="checkbox" name="j_id2:j_id4:1:j_id5" />
      <input type="checkbox" name="j_id2:j_id4:2:j_id5" />
      <input type="checkbox" name="j_id2:j_id4:3:j_id5" />
      <input type="checkbox" name="j_id2:j_id4:4:j_id5" />
      <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="_id1" />
      </form>
       </body>
      
      </html>





        • 1. Re: <h:selectBooleanCheckbox>
          kannattaa

          i use seam 2.0.0.BETA1

          • 2. Re: <h:selectBooleanCheckbox>
            thejavafreak

            Why did you use ui:repeat? Why not use c:forEach ?

            • 3. Re: <h:selectBooleanCheckbox>
              pmuir

              h:selectBooleanCheckbox is an input not output component. It takes a value binding in value. If you just want to output ticked checkboxes use

              <ui:repeat ...>
               <input type="checkbox" checked />


              • 4. Re: <h:selectBooleanCheckbox>
                kannattaa

                 

                "pete.muir@jboss.org" wrote:
                h:selectBooleanCheckbox is an input not output component. It takes a value binding in value. If you just want to output ticked checkboxes use

                <ui:repeat ...>
                 <input type="checkbox" checked />


                1) outside the loop the selectBooleanCheckbox renders its value properly.
                2) in fact, i have non static values, but i've simplified it to post trivial example.

                • 5. Re: <h:selectBooleanCheckbox>
                  pmuir

                   

                  "kannattaa" wrote:
                  "pete.muir@jboss.org" wrote:
                  h:selectBooleanCheckbox is an input not output component. It takes a value binding in value. If you just want to output ticked checkboxes use

                  <ui:repeat ...>
                   <input type="checkbox" checked />


                  1) outside the loop the selectBooleanCheckbox renders its value properly.


                  Yes, I can read.

                  2) in fact, i have non static values, but i've simplified it to post trivial example.


                  This was one trivialisation too far. Why don't you post some code that actually does something.