EasyUI Forum
June 16, 2024, 03:44:25 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Why this form won't submitted ?  (Read 11733 times)
heru
Newbie
*
Posts: 12


View Profile
« on: July 16, 2012, 09:40:58 PM »

hi all, please someone tell me what's wrong with this code ? why the form won't submitted ?

HTML

<!DOCTYPE html>
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <meta name="keywords" content="jquery,ui,easy,easyui,web">
   <meta name="description" content="easyui help you build your web page easily!">
   <title>Grid Validation</title>
   <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
   <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
   <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
   <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
   <script type="text/javascript">
   $(document).ready(function(){   
      $('#xx').combogrid({
         panelWidth:450,            
         required:true,
         multiple:false,
         idField:'code',
         textField:'name',
         url:'data/datagrid_data.json',
         columns:[[
            {field:'code',title:'Code',width:60},
            {field:'name',title:'Name',width:100},
            {field:'addr',title:'Address',width:120},
            {field:'col4',title:'Col41',width:100}
         ]]
      });
      $('#ff').form({            
         success:function(data){
            $.messager.alert('Info', data, 'info');
         }
      });
   });
      
   </script>
</head>
<body>   
   <form id="ff" method="post" action="index.php">
      <table>
         <tr>
            <td>Name:</td>
            <td><input type="text" name="name" style="width:350px;"/></td>
         </tr>
         <tr>
            <td>Address:</td>
            <td><input type="text" name="address" style="width:350px;"/></td>
         </tr>
         <tr>
            <td>City:</td>
            <td><select class="easyui-combotree easyui-validatebox" required="true" url="data/city_data.json" name="city" style="width:156px;"/></td>
         </tr>
         <tr>
            <td>Item:</td>
            <td><select class="easyui-validatebox" id="xx" name="xx" style="width:350px;"/></td>
         </tr>         
         <tr>
            <td></td>
            <td><input type="submit" value="Submit"></input></td>
         </tr>
      </table>
   </form>   
</body>
</html>

index.php

<?php

$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$item= $_POST['xx'];
echo "Your Name: $name <br/> Your Address: $address <br/>Provinsi $item<br/> Your City ID: $city";

?>

data/datagrid_data.json

{                                                     
   "total":239,                                                     
   "rows":[                                                         
      {"code":"001","name":"Name 1","addr":"Address 11","col4":"col4 data"},         
      {"code":"002","name":"Name 2","addr":"Address 13","col4":"col4 data"},         
      {"code":"003","name":"Name 3","addr":"Address 87","col4":"col4 data"},         
      {"code":"004","name":"Name 4","addr":"Address 63","col4":"col4 data"},         
      {"code":"005","name":"Name 5","addr":"Address 45","col4":"col4 data"},         
      {"code":"006","name":"Name 6","addr":"Address 16","col4":"col4 data"},         
      {"code":"007","name":"Name 7","addr":"Address 27","col4":"col4 data"},         
      {"code":"008","name":"Name 8","addr":"Address 81","col4":"col4 data"},         
      {"code":"009","name":"Name 9","addr":"Address 69","col4":"col4 data"},         
      {"code":"010","name":"Name 10","addr":"Address 78","col4":"col4 data"}     
   ]                                                         
}   

data/city_data.json

[{
   "id":1,
   "text":"City",
   "children":[{
      "id":11,
      "text":"Wyoming",
      "children":[{
         "id":111,
         "text":"Albin"
      },{
         "id":112,
         "text":"Canon"
      },{
         "id":113,
         "text":"Egbert"
      }]
   },{
      "id":12,
      "text":"Washington",
      "state":"closed",
      "children":[{
         "id":121,
         "text":"Bellingham"
      },{
         "id":122,
         "text":"Chehalis"
      },{
         "id":123,
         "text":"Ellensburg"
      },{
         "id":124,
         "text":"Monroe"
      }]
   }]
}]
Logged
rolin
Newbie
*
Posts: 3


View Profile Email
« Reply #1 on: July 22, 2012, 07:31:07 PM »

coba gunakan $_REQUEST bukan $_POST untuk menampung datanya bisa atau tidak?
Logged
heru
Newbie
*
Posts: 12


View Profile
« Reply #2 on: July 24, 2012, 08:28:48 PM »

OK, problem fixed. masalahnya ada di combogrid, setting required=true pada inisialisasi combogrid konflik dengan html5...

referensi: http://www.jeasyui.com/forum/index.php?topic=505.msg1100#msg1100
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!