This is Submit form code
Index.php
<form action="insert_data.php" method="post" name="ff" id="ff">
<div style="margin:10px 0;"></div>
<div class="easyui-panel" title="Please input data" style="width:800px;height:600px;padding:45px;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',title:'Input Data ',collapsible:false" style="height:125px;padding:10px">
<table>
<tr>
<td>ID:</td>
<td><input name="ID" type="text" class="easyui-validatebox" size="15" data-options="required:true"></input></td>
<td> </td>
<td>Date:</td>
<td><input name="date" class="easyui-datebox" size="15" data-options="required:true,formatter:myformatter,parser:myparser"></input>
<script type="text/javascript">
function myformatter(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
}
function myparser(s){
if (!s) return new Date();
var ss = (s.split('-'));
var y = parseInt(ss[0],10);
var m = parseInt(ss[1],10);
var d = parseInt(ss[2],10);
if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
return new Date(y,m-1,d);
} else {
return new Date();
}
}
</script>
</td>
</tr>
</table>
</div>
</div>
</div>
<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>
</form>
<script>
function submitForm(){
$('#ff').form('submit');
}
function clearForm(){
$('#ff').form('clear');
}
</script>
server response is: "OK"
the problem is:
if the submit button is:
<input type="submit" value="Submit">
then form $POST send to insert_data.php shows ok and change to insert_data.php and show result, but skip easyui-validatebox checking.
if this submit is:
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">Submit</a>
then form easyui-validatebox checking is work and $POST is ok , but cannot change to insert_data.php and show result page
insert_data.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Resuit</title>
</head>
<body>
<?php
echo "<BR>". $_POST['id'];
echo "<BR>". $_POST['date'];
?>
</body>
</html>