|
@@ -965,6 +965,8 @@ function(tb,specFieldSetup,setup){
|
|
|
cell1.appendChild(b);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
crfVisit.populateFieldRow=
|
|
@@ -1024,7 +1026,7 @@ function(entry,field,setup){
|
|
|
let fName='[populateFieldName/'+vName+']';
|
|
|
let config=this.config;
|
|
|
|
|
|
- let varValue="UNDEF";
|
|
|
+ let varValue=null;
|
|
|
|
|
|
//if (vName in setup.filters) varValue=setup.filters[vName];
|
|
|
if (vName in entry) varValue=entry[vName];
|
|
@@ -1043,12 +1045,11 @@ function(entry,field,setup){
|
|
|
|
|
|
//date
|
|
|
if (vType=="date"){
|
|
|
- if (varValue=="UNDEF") varValue=new Date();
|
|
|
- else varValue=new Date(varValue);
|
|
|
+ if (varValue) varValue=new Date(varValue);
|
|
|
}
|
|
|
|
|
|
//lookup for readonly
|
|
|
- if (isLookup && varValue!="UNDEF"){
|
|
|
+ if (isLookup && varValue){
|
|
|
let lookup=field["lookup"];
|
|
|
//get all values from config.formConfig.lookup[X]
|
|
|
let lObject=config.formConfig.lookup[lookup.queryName];
|
|
@@ -1061,7 +1062,6 @@ function(entry,field,setup){
|
|
|
this.print('Element type: '+eType);
|
|
|
|
|
|
//change varValue for printing
|
|
|
- if (varValue=="UNDEF") varValue="";
|
|
|
//HTMLTextArea, createElement(textArea)
|
|
|
if (eType==="textarea"){
|
|
|
input.value=varValue;
|
|
@@ -1099,6 +1099,7 @@ function(entry,field,setup){
|
|
|
let type=input.type;
|
|
|
|
|
|
if (type=="date"){
|
|
|
+
|
|
|
input.valueAsDate=varValue;
|
|
|
return;
|
|
|
}
|
|
@@ -1115,6 +1116,30 @@ function(entry,field,setup){
|
|
|
this.print('Unknown input type: '+type+'. Ignoring.');
|
|
|
}
|
|
|
|
|
|
+crfVisit.populateSpecialFieldRow=
|
|
|
+function(specFieldSetup,entry,field,setup){
|
|
|
+ //tb is the table, specFieldSetup is a row from the table where special fields are being setup
|
|
|
+ //the first column is fieldUID, which is a colon joined amalgation of queryName:fieldName
|
|
|
+ let fieldUID=specFieldSetup["fieldUID"];
|
|
|
+ let x=fieldUID.split(':');
|
|
|
+ let fName="[addSpecialFieldRow/"+fieldUID+"]";
|
|
|
+ let q=variableList.parseVariables(specFieldSetup['actionParameters']);
|
|
|
+ let config=this.config;//for add data
|
|
|
+ this.print(fName);
|
|
|
+
|
|
|
+ if (specFieldSetup['actionType']=='maskDate'){
|
|
|
+ let el=this.getElement(setup.getInputId(field.name));
|
|
|
+ let operator=config.formConfig.operator;
|
|
|
+ let applyMask=true;
|
|
|
+ if ('role' in q && q['role']!=operator) applyMask=false;
|
|
|
+ if (applyMask){
|
|
|
+ let date=new Date(el.innerText);
|
|
|
+ this.print(fName+' value '+el.innerText+" date "+date+' year '+date.getFullYear());
|
|
|
+ el.innerText=date.getFullYear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
crfVisit.populateTable=
|
|
|
function(listName,writeMode){
|
|
|
//function populateTable(formSetupEntry){
|
|
@@ -1148,6 +1173,13 @@ function(listName,writeMode){
|
|
|
if (field.hidden) continue;
|
|
|
if (field.name=="crfRef") continue;
|
|
|
this.populateFieldRow(entry,field,setup);
|
|
|
+ let fieldUID=listName+":"+field.name;
|
|
|
+ if (fieldUID in this.config.formConfig["specialFields"]){
|
|
|
+ let specFieldSetup=this.config.formConfig["specialFields"][fieldUID];
|
|
|
+ this.populateSpecialFieldRow(specFieldSetup,entry,field,setup);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1208,6 +1240,7 @@ function(listName,divName,additionalData,setup){
|
|
|
if (fieldUID in config.formConfig["specialFields"]){
|
|
|
let specFieldSetup=config.formConfig["specialFields"][fieldUID];
|
|
|
this.addSpecialFieldRows(tb,specFieldSetup,setup);
|
|
|
+ this.populateSpecialFieldRow(specFieldSetup,entry,field,setup);
|
|
|
}
|
|
|
|
|
|
|