EasyUI Forum
May 03, 2024, 12:28:08 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / Bug Report / textbox with multiline more space character encode error on: May 26, 2017, 01:42:55 AM
try to input some character in textbox , and post to php server, the php receive data was wrong, not the string which we input in the textbox.

example, in multiline textbox , we input three character: char '1' and space character, then enter into new line, input char '2' at second line, and finished to post.

the string which we input into textbox is '1 \n2', then get the textbox value by $("#test").textbox("getValue") , and the value in hex is \x31,\xa0,\x0a,\x32 . this hex string is wrong ,the correct hex string is \x31,\x20,\x0A,\x32.

the php server receive string hex is different, our php code receive string in hex is \x31,\xc2,\xa0,\x0a,\x32. the \xc2,\xa0 is not our input character.

we try chrome debug tools catch the post header , found the form data encoding was : data=1%C2%A0%0A2.  "%C2%A0%" this string should be "%20", but i can't found any function can change the form data encoding by the web browser.

finally , i use textarea replace textbox in html file,  then the php server receive right string which we input into the textarea.



all test source as following:
test.html file:
-------------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>oracle</title>
<script src="jquery-easyui-1.4.2/jquery.min.js"></script>
<script src="jquery-easyui-1.4.2/jquery.easyui.min.js"></script>
<script src="jquery-easyui-1.4.2/locale/easyui-lang-zh_CN.js"></script>
<script src="common.js"></script>
<link href="jquery-easyui-1.4.2/themes/default/easyui.css"
        type="text/css" rel="stylesheet">
<link href="jquery-easyui-1.4.2/themes/icon.css" type="text/css"
        rel="stylesheet">

</head>
<body>

        <div style="margin:20px 0;"></div>
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="test_submit()">Add</a><br>
        <input class="easyui-textbox" data-options="multiline:true"  id="test"  style="white-space:pre-wrap;width:200px;height:100px"></input>
</body>
</html>



javascript common.js
-----------------------------------------------------------------------
function test_submit()
{
        var txt=$("#test").textbox("getValue");
        var u_txt=stringToHex(txt);

        $.post("test.php", {
                "data" : txt
        }, function(data) {
              $.messager.alert('error',u_txt+'\n'+data, 'error');
        });

}
function stringToHex(str){
        var val=new Array();
        for(var i = 0; i < str.length; i++){
                var tmp='0'+str.charCodeAt(i).toString(16);
                val.push(tmp.substr(-2));
    }
        return val;
}



php test.php
------------------------------------------
<?php

function str2hex($str) {
        $ret = "";
        for($i = 0; $i < strlen ( $str ); ++ $i) {
                $c = $str [$i];
                $ac = ord ( $c );
                $p = "0" . strval ( dechex ( intval ( $ac ) ) );
                $ret .= substr ( $p, - 2 );
        }
        return $ret;
}

$data=$_POST["data"];
echo str2hex($data);

?>



os: windows server 2008R2  x64 sp1
browser: google chrome 37.0.2062.103
jquery-easyui-1.4.2
2  General Category / Bug Report / Re: combobox with multiple and multiline in form bug 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.
3  General Category / Bug Report / combobox with multiple and multiline in form bug 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?
4  General Category / Bug Report / Re: filebox not work in IE8 jquery-easyui-1.4.2 on: April 19, 2015, 11:17:35 PM
ok,after add those line it's work fine with IE8.


Think you very much!
5  General Category / Bug Report / filebox not work in IE8 jquery-easyui-1.4.2 on: April 19, 2015, 04:14:04 AM
in jquery-easyui-1.4.2 demo, the filebox example not work with IE8, but in firefox it's ok.

is it does not support IE8 ?

IE8 version : 8.0.6001.18702 with x86.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!