<script>
$(function(){
var createDateBeg = new Ext.form.DateField({
format:'Ymd',
readOnly: false,
applyTo: 'createDateBeg',
afterRender: function(){$('#createDateBeg').val('${(sfd(wmsPartitionDto.createDateBeg))!''}')}
});
var createDateEnd = new Ext.form.DateField({
format:'Ymd',
readOnly: false,
applyTo: 'createDateEnd',
afterRender: function(){$('#createDateEnd').val('${(sfd(wmsPartitionDto.createDateEnd))!''}')}
});
});
</script>
上面是js 的写法,jquery+ext 然后 下面是html 的代码片段,为什么在 struts2的action里获取不到值呢? <td class="rightP">创建时间 from:</td>
<td>
<input type="text" name="wmsPartitionDto.createDateBeg" id="createDateBeg">
</td>
<td class="rightP">创建时间 to:</td>
<td>
<input type="text" name="wmsPartitionDto.createDateEnd" id="createDateEnd">
</td>
wmsPartitionDto这个dto都有 那个开始时间和结束时间 字段谢谢 ,请帮忙看看
<input type="hidden" name="wmsPartitionDto.wareHouseId" value="${(wmsPartitionDto.wareHouseId)!''}"/>
<tr width="100%">
<td class="rightP">库区名称:</td>
<td class="left"><@s.textfield cssClass="x-form-text" id='partitinonType' name="wmsPartitionDto.partitionType"/></td>
</tr>
<tr>
<td class="rightP">创建时间 from:</td>
<td>
<input type="text" name="wmsPartitionDto.createDateBeg" id="createDateBeg">
</td>
<td class="rightP">创建时间 to:</td>
<td>
<input type="text" name="wmsPartitionDto.createDateEnd" id="createDateEnd">
</td>
</tr>
</table>partitinonType可以取到值,可是下面2个 都取不到,不知道为什么,调试了下
jquery还是看的懂
ext今天才把api弄下来
这东西有值吗?
这东西有值吗?
<td>
<@s.textfield name="wmsPartitionDto.createDateBeg" id="createDateBeg"/>
</td>
<td class="rightP">创建时间 to:</td>
<td>
<@s.textfield name="wmsPartitionDto.createDateEnd" id="createDateEnd"/>
</td>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="/wms-web/js/lib/ext2/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/wms-web/css/admin.css" />
<link rel="stylesheet" type="text/css" href="/wms-web/js/lib/jquery/validate_css/screen.css" />
<style type="text/css">
<!--
body {
margin-left: 5px;
margin-right: 5px;
}
-->
</style> <script type="text/javascript" src="/wms-web/js/lib/jquery/jquery-1.2.3.js"></script>
<script type="text/javascript" src="/wms-web/js/lib/jquery/jquery.validate.js"></script>
<script type="text/javascript" src="/wms-web/js/lib/ext2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/wms-web/js/lib/ext2/ext-all.js"></script>
<script type="text/javascript" src="/wms-web/js/framework/ui/data/DwrConnection.js"></script>
<script type="text/javascript" src="/wms-web/js/framework/ui/data/DwrHttpProxy.js"></script>
<script type="text/javascript" src="/wms-web/js/framework/ui/data/DwrJsonReader.js"></script>
<script type="text/javascript" src="/wms-web/js/framework/ui/form/DwrAction.js"></script>
<script type="text/javascript" src="/wms-web/js/lib/jsoner1.24/jsoner.commons.js"></script>
<script type="text/javascript" src="/wms-web/js/lib/jsoner1.24/jsoner.js"></script>
<script type="text/javascript" src="/wms-web/js/lib/dwr/engine.js"></script> <script type="text/javascript" src="/wms-web/js/common/common.js"></script>
<script type="text/javascript" src="/wms-web/js/common/profile/profile.js"></script>
<script type="text/javascript">
Ext.BLANK_IMAGE_URL = " /wms-web/js/lib/ext2/resources/images/default/s.gif";
var profileBaseDir = "/wms-web/js/common/profile/";
</script>
<script type='text/javascript' src='/wms-web/dwr/interface/wmsPartitionAction.js'></script>
<script type='text/javascript' src='/wms-web/js/common/wmsPrinter.js'></script>
<link href="../admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function(){
var createDateBeg = new Ext.form.DateField({
format:'Ymd',
readOnly: false,
applyTo: 'createDateBeg',
afterRender: function(){$('#createDateBeg').val('')}
});
var createDateEnd = new Ext.form.DateField({
format:'Ymd',
readOnly: false,
applyTo: 'createDateEnd',
afterRender: function(){$('#createDateEnd').val('')}
});
});
function editWmsPartition(id, isEdit){
window.open("/wms-web/wms/stock/editPartition.action?wmsPartition.id=" + id + "&isEdit=" + isEdit);
}
function deleteWmsPartition(id){
if(confirm("确定要删除吗?")){
window.location="/wms-web/wms/stock/deletePartition.action?wmsPartition.id=" + id;
}
}
</script> </head> <body>
<div align="">
<div></div>
<table align="center" width="98%" height="100%" border="0" cellpadding="0" cellspacing="0" id="main">
<tr>
<td valign="top" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> <td id="nav">您的位置:<span class="red14">库区管理</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" align="left">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="mt10" width="500">
<form id="f0" name="findPartitionResult" onsubmit="return true;" action="/wms-web/wms/stock/findPartitionResult.action" method="post"> <tr bgcolor="#EDF5FA">
<td>
<div style="padding:5px;">
<input type="button" value="新增库区" class="button2" onclick="editWmsPartition(null, false)" />
</div>
</td>
</tr>
<tr bgcolor="#EDF5FA">
<td> <table border="0" cellpadding="0" cellspacing="0" class="mt10" width="600">
<input type="hidden" name="wmsPartitionDto.wareHouseId" value="1"/>
<tr width="100%">
<td class="rightP">库区名称:</td>
<td class="left"><input type="text" name="wmsPartitionDto.partitionType" value="" id="partitinonType" class="x-form-text"/></td>
</tr>
<tr>
<td class="rightP">创建时间 from:</td>
<td>
<input type="text" name="wmsPartitionDto.createDateBeg" value="" id="createDateBeg" class="x-form-text"/> </td> <td class="rightP">创建时间 to:</td>
<td>
<input type="text" name="wmsPartitionDto.createDateEnd" value="" id="createDateEnd" class="x-form-text"/> </td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#EDF5FA" align="center"> <td colspan="8">
<input type="submit" id="f0_0" value="检索" class="button2"/>
</td>
</tr>
</form> </table>
</td>
</tr>
<tr> <td>
<table align="left" width="100%" border="0" cellpadding="0" cellspacing="0" class="mt10" >
<tr>
<td valign="top" >
</td>
</tr>
</table>
</td>
</tr> </table>
<div></div>
</div>
</body>
</html>
全部源代码。 在 输入 时间 之后的 源代码, 服务器 没有接受到,那2个时间控件的值 我通过firebug看了 post的过程了
LZ提交的数据有没有通过中间传递的方式传递,即LZ在取时间控件的地方是直接解析的form表单请求吗
确保这里有值就没有问题了
先给它赋个初值试试看