Title: combobox with multiple and multiline in form bug Post by: ljpxg 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? Title: Re: combobox with multiple and multiline in form bug Post by: stworthy 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[]" Title: Re: combobox with multiple and multiline in form bug Post by: ljpxg 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. |