EasyUI Forum
May 05, 2024, 06:48:37 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: combobox with multiple and multiline in form bug  (Read 8502 times)
ljpxg
Newbie
*
Posts: 5


View Profile
« on: April 28, 2015, 01:46:21 AM »

combobox with multiple and multiline in form , when submit form, the combobox commit each select value with same variable name to server.


thml example:

   <div class="easyui-panel" title="New Topic" style="width: 400px">
      <div style="padding: 10px 60px 20px 60px">
         <form id="ff" method="post" action="action.php">
            <select class="easyui-combobox" name="state"
               data-options="multiple:true,multiline:true"
               style="width: 200px; height: 50px">
               <option value="AL">Alabama</option>
               <option value="AK">Alaska</option>
               <option value="AZ">Arizona</option>
               <option value="AR">Arkansas</option>
               <option value="CA">California</option>
               <option value="CO">Colorado</option>
               <option value="CT">Connecticut</option>
               <option value="DE">Delaware</option>
               <option value="FL">Florida</option>
               <option value="GA">Georgia</option>
               <option value="HI">Hawaii</option>
               <option value="ID">Idaho</option>
            </select>
         </form>
         <div style="text-align: center; padding: 5px">
            <a href="javascript:void(0)" class="easyui-linkbutton"
               onclick="submitForm()">Submit</a> <a href="javascript:void(0)"
               class="easyui-linkbutton" onclick="clearForm()">Clear</a>
         </div>
      </div>
   </div>
   <script>
      function submitForm() {
         $('#ff').form('submit');
      }
      function clearForm() {
         $('#ff').form('clear');
      }
   </script>


select 'Alabama' and 'Alaska'  in this form , and then submit form , use firebug to catch the post params , we found it post two parameter value 'AL' and 'AK' with same variable name 'state', not submit one parameter 'state' .

in firebug the form data like this:
state:'AL'
state:'AK'

normal the form must post parameter name 'state' and with value 'AL,AK', but in this case, the server side 'action.php' will only receive the last 'state' value of 'AK' , and the value 'AL' was lost.

how to resolve it?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 28, 2015, 01:50:22 AM »

It is not the bug. Please use the 'state[]' name instead in your page code.
Code:
<select class="easyui-combobox" name="state[]"
               data-options="multiple:true,multiline:true"
               style="width: 200px; height: 50px">
...
</select>
Logged
ljpxg
Newbie
*
Posts: 5


View Profile
« Reply #2 on: April 28, 2015, 02:16:04 AM »

yes use  name='state[]'  it's work fine, think you very much.


By the way, if the demo file has set this property, we can find the solutions by ourself.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!