第三方基于Web的工作流程应用程序。如果字段为空,请尝试使用javascript将今天的日期插入网格日期字段。
如果我设置以下代码:
function todayDate(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if (dd<10) {
dd='0'+dd
}
if (mm<10) {
mm='0'+mm
}
today = yyyy+'/'+mm+'/'+dd;
$("#Travel_ItineraryDetails").setValue(today,1,1);
}
todayDate();
它将日期插入到正确的字段中。每次用户打开表单时,这也会覆盖日期。
网格名称:Travel_ItineraryDetails
字段名称:日期
字段是网格中的第一个字段,因此在上面的.setValue命令中为1,1。
答案 0 :(得分:0)
和processmaker
..
使用$("#gridId").getValue(row, col)
(可用版本:3.0.1.3及更高版本。)
processmaker
的变体
function todayDate(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if (dd<10) {
dd='0'+dd
}
if (mm<10) {
mm='0'+mm
}
today = yyyy+'/'+mm+'/'+dd;
var elem = document.getElementById("Travel_ItineraryDetails");
if( elem.innerHTML =="")
// $("#Travel_ItineraryDetails").html(today); with jQuery
elem.innerHTML = today;
}
todayDate();
&#13;
<div id=Travel_ItineraryDetails></div>
&#13;
function todayDate(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if (dd<10) {
dd='0'+dd
}
if (mm<10) {
mm='0'+mm
}
today = yyyy+'/'+mm+'/'+dd;
var elem = document.getElementById("Travel_ItineraryDetails").rows[0].cells[0];
if( elem.innerHTML =="")
// $("#Travel_ItineraryDetails").html(today); with jQuery
elem.innerHTML = today;
}
todayDate();
&#13;
<table id="Travel_ItineraryDetails">
<tr class="row">
<td class="cell"></td>
<td class="cell">2</td>
</tr>
<tr class="row">
<td class="cell">3</td>
<td class="cell">4</td>
</tr>
</table>
&#13;
答案 1 :(得分:0)
ProcessMaker有两种方法,一种是使用Trigger,另一种是使用Javascript编写。
Akubik的答案很好但是如果你想要触发器,你只需要在PHP代码中使用它:
$date_field = @@date_field;
//it is my hobby to store processmaker variables in a PHP variables
if(!empty($date_field))
{
@@date_field = date("Y/m/d");
//i force PM variable to use the date for today
//by default processmaker is using YYYY-MM-DD
}
将其置于触发器中并在Dynaform之前放置该触发器。