[ 
https://issues.apache.org/struts/browse/WW-1927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Holmes updated WW-1927:
-----------------------------

    Fix Version/s:     (was: Future)
                   2.0.11

> Value of checkbox and hidden field have problem in s:form
> ---------------------------------------------------------
>
>                 Key: WW-1927
>                 URL: https://issues.apache.org/struts/browse/WW-1927
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.6
>         Environment: apache-tomcat-5.5.20/jdk1.5_06
>            Reporter: Rulin Sun
>             Fix For: 2.0.11
>
>
> Jsp:
> <s:form id="Form1" action="Action"  method="post" theme="ajax">
> <input type="hidden" name="selectedProduct" value="Test" />
> <table border="0" cellpadding="0" cellpadding="20" width="100%">
>        <tr>
>       <td align="right">
>               Box: <input type="checkbox" name="box"/>
>       </td>
>       <td align="center">
>               Pending: <input type="checkbox"  name="pending" />
>       </td>
>       <td align="left">
>               Fail: <input type="checkbox" name="fail" />
>       </td>
>                     <td>
>                              <input type="submit" dojoType="struts:Bind" 
> event="onclick"   value="Query"  
>                        id="Form1_0"    targets="Table1"  />
>                     </td>
>         </tr>
> </table>
> </s:form>
> <div id="Table1" />
> Java Action:
>                       private String selectedProduct;
>                       private boolean box = false;
>        private  boolean pending = true;
>        private  boolean fail = true;
>       /**
>        * @return the box
>        */
>       public boolean isBox() {
>               System.out.println("$$$$$$$$$$$ isbox = " + this.box);
>               return box;
>       }
>       /**
>        * @param box the box to set
>        */
>       public void setBox(boolean box) {
>               System.out.println("$$$$$$$$$$$ setbox = " + box);
>               this.box = box;
>       }
>                     public String getSelectedProduct() {
>               return selectedProduct;
>       }
>       public void setSelectedProduct(String selectedProduct) {
>                                         System.out.println("$$$$$$$$$$$ 
> selectedProduct = " + selectedProduct);
>               this.selectedProduct = selectedProduct;
>       }
>          ....
> Problems:
>     1) When the is Jsp loaded as "INPUT" result, all three checkboxes are 
> checked, (expected result: box not checked )
>     2) When check/uncheck any of checkboxes, server side prints false/true 
> value for corresponding field (expected result: true/false), 
>     3) For hidden field "selectedProduct", a commas and a space symbol are 
> prepended to actual value, the printed result is ", Test" (expected value: 
> "Test"). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to