2 Field basical operation interface (Apply for all field types)

1 Convert field name to field id

This method support to achieve multi-form, multi-environment, code block commonly using; decoupling code block specified fieldid convertFieldNameToId:function (fieldname, symbol, prefix)

Parameter Description

ParametertypeRequiredRemarks

fieldname

String

Yes

Field name

symbol

String

No

Form label, main table (main)/ specific schedule (detail_1), default main

prefix

Boolean

No

Returns whether the value needs to field a string prefix, default to true

Example

var fieldid =WfForm.convertFieldNameToId ("zs");
var fieldid =WfForm.convertFieldNameToId ("zs_mx","detail_1");
var fieldid =WfForm.convertFieldNameToId ("zs_mx","detail_1", false);

2 Gets a single field value

getFieldValue:function (fieldMark)

Parameter Description

ParametertypeRequiredRemarks

fieldMark

String

Yes

field designation, format field${ field ID}_field${ line number}

Example

var fieldvalue = WfForm.getFieldValue ("field110");

3 Modify a single field value

This method modifies fields that, if they involve trigger linkage, cell formatting, etc., automatically trigger linkage/format change values in a format similar to other scenarios changeFieldValue:(fieldmark, valueInfo)

Parameter Description

ParametertypeRequiredRemarks

fieldMark

String

Yes

field designation, format field${ field ID}_field${ line number}

valueInfo

JSON

Yes

The field value information, the non-browsing button field format is {value:" modified value "}; the specialobj is browsing button information, array format; the showhtml property is only valid for single line text type and read-only;

Example

// Modify field types such as text boxes, multi-line text, selection boxes, etc
WfForm.changeFieldValue ("field123",{ value:"1.234"});
// Modify the value of the browse field to have specialobj array structure objects
WfForm.changeFieldValue ("field11_2"),{
 value:"2,3",
 specialobj:[
 	{id:"2",name:" Zhang San},
 	{id:"3",name:" Li Si}
    ]
});     
// Modify the check box field (0 unchecked ,1 checked)
 WfForm.changeFieldValue ("field123",{ value :"1"});
// For single-line text-box type, read-only, support display values that are inconsistent with library values
WfForm.changeFieldValue ("field123"),{
 value:"  actual value of storage ",
 specialobj:{
 showhtml:" interface display value "
    }
});

4 Change the single field display properties (read-only/mandatory, etc.)

changeFieldAttr:function (fieldMark, viewAttr)

Parameter Description

ParametertypeRequiredRemarks

fieldMark

String

Yes

field designation, format field${fieldID}_field${line number}

viewAttr

int

Yes

Change the status of the field ,1:Read-Only ,2:Editable ,3:Mandatory ,4:Hidden the field label and content

Example

WfForm.changeFieldAttr ("field110",1);
// field changed to read-only
WfForm.changeFieldAttr ("field110",4);
// field label and content are hidden, the effect is consistent with the display attribute hidden, only support the main table field

5 Modify field values and display properties

changeSingleField:function (fieldMark, valueInfo, variableInfo)

Parameter Description

ParametertypeRequiredRemarks

fieldMark

String

Yes

field designation, format field${fieldID}_field${linenumber}

valueInfo

JSON

No

Field value information, consistent with interface 2 format, example :{value:" modified value "}

variableInfo

JSON

No

Change property, example :{ viewAttr:3}

Example

WfForm.changeSingleField (" field110",{ value :" modified value "},{ viewAttr:"1"});
// modified value and set it to read-only

6 Batch modification of field values or display propoerties

changeMoreField:function (changeDatas, changeVariable)

Parameter Description

ParametertypeRequiredRemarks

changeMoreField

JSON

Yes

Modified field value information set

changeVariable

SON

No

Modified field display property collection

Example

WfForm.changeMoreField ({
 	field110:{value:" the modified value "},
 	field111:{value:"2,3",specialobj:[
 {id:"2",name:" Zhang San "}{ id:"3",name:" Li Si "}
    ]},
    ...
},{
 	field110:{viewAttr:2},
 	field111:{viewAttr:3},
    ...
});

Note: Manually triggering all linkage involved in a single field, including field linkage, SQL linkage, date-time calculation, field assignment, formula, row rules, display attribute linkage, selection box linkage, bindPropertyChange event binding, etc.

Scenario: triggered subprocesses open default non-execution field linkage, archive node view form non-execution linkage

triggerFieldAllLinkage: (fieldmark)

Parameter Description

ParametertypeRequiredRemarks

fieldMark

String

Yes

field designation, format field${ field ID}_field${ line number}

// form opens the linkage to enforce a field linkage
jQuery(document).ready(function(){
 WfForm.triggerFieldAllLinkage("field110");
 // execute all linkage involved in the  field
});

8 Obtain field information base on field ID

Note: obtain field information according to field ID, JSON format, including name, type, read-only properties, etc.

getFieldInfo:function (fieldid)

Parameter Description

ParametertypeRequiredRemarks

fieldid

String

Yes

Field ID, without any indication

Return value propoeties description

ParameterRemarks

htmltype

field large type (text/multiline text...)

detailtype

field small type (integer/float...)

fieldname

field database name

fieldlabel

field display name

viewattr

field attribute (1: read-only 2: editable 3: required)

WfForm.getFieldInfo("111");

9 Get field current read-only/mandatory properties

This method is to obtain field display properties in real time, including possible changes such as display property linkage, code interface change, done, detail existing fields can not be modified, not only field properties of background configuration;

If you only want to obtain field properties of background configuration, call interface 3.8 return value viewattr property

getFieldCurViewAttr:function(fieldMark)

Parameter Description

ParametertypeRequiredRemarks

fieldMark

String

Yes

field designation, format field${fieldID}_field${linenumber}

 WfForm.getFieldCurViewAttr("field110_2");
 // Get detail field properties ,1: read-only ,2: editable ,3: mandatory; all done read-only;

Last updated