Classes
-
new SecOpt( [ prefix [, center [, suffix [, lblIndex ] ] ] ] )
Constructor for pdf report Section Header types
-
Methods
-
buildBullets( str ) → {string}
Converts paragraphs to html bullets
-
Description
Converts string to html list bullet points. Splits the input string by line breaks (handles both \n and \r\n). Filters out empty lines. Trims whitespace from each line
Parameters
Name Type Description strstring Returns
-
buildDescription( [ dn ] ) → {string}
Gets description text from field
-
Description
Returns description text from FIELD() if it exists, wrapped in italics tags and parentheses.
Parameters
Name Type Attributes Default Description dnstring <optional> '' Returns
-
choiceListRequest( [ id ] ) → {Array.<string>}
Request choiclist options from Fulcrum API
-
Description
Get choicelist options from a refrenced fulcrum choicelist app if choices not located in app
Parameters
Name Type Attributes Default Description idstring <optional> '' Returns
-
buildSimpleCell( input [, i ] ) → {string}
Creates html string for a horizontal layout cell in Merjent default grid.
-
Description
Creates html content for a single cell of grid using Merjent .grid-lo stylesheet. Without nesting within a surrounding div. The label and value will be displayed horizontally instead of vertically.
Parameters
Name Type Attributes Default Description inputstring | Mfld data name or Mfld
i* <optional> Returns
-
buildSimpleRows( [ mflds [, i ] ] ) → {string}
Creates html grid-rows for a horizontal layout cells in Merjent default grid.
-
Description
Creates html rows with the getSimpleCell() method. (ie: horizontal label/value)
If field is a label, the type property must be set to 'mLabel' in order to print on pdf.
Parameters
Name Type Attributes Default Description mfldsMfld <optional> [] i* <optional> Returns
-
buildDefaultCell( input [, i ] ) → {string}
Creates html for single Merjent default grid cell.
-
Description
create a single cell using Merjent .grid-lo stylesheet.
Span width and options are read from Mfld parameter.
Parameters
Name Type Attributes Default Description inputstring | Mfld i* <optional> i is only used if called within a repeatable loop
Returns
-
buildDefaultRows( [ mflds [, i [, exc ] ] ] ) → {string}
Creates html grid-rows for a Merjent default grid.
-
Description
Populate rows of grid using Merjent .grid-lo .default stylesheet.
Parameters
Name Type Attributes Default Description mfldsMfld <optional> [] i* <optional> Only used mflds are from a Repeatable section
excArray.<string> <optional> [] Array of data names to exclude from the grid
Returns
-
getSecCenter( secOpt, index ) → {string}
Get center portion of section header text.
-
Description
Gets the central text to display in a section header from a SecText object.
If there is a 'center' property it will be the value. If there is a 'rep_data_name' property it will be the value. Defaults to the LABEL(data_name)
Parameters
Name Type Description secOptSecOpt index* Returns
Details
-
obj2SecOpt( obj ) → {SecOpt}
-
Description
builds a SecOpt object based off an old style object
Parameters
Name Type Description objThe object to convert to SecOpt
Returns
Details
-
getSecTxt( secOpt [, index ] ) → {string}
-
Description
Constructs string for section header text
Parameters
Name Type Attributes Default Description secOptEither a SecOpt object or an old style object to be converted to SecOpt
indexnumber <optional> 0 Returns
Details
-
getSecHtml( secOpt, i ) → {string}
-
Description
Constructs html for section header from secOpt object. For a non-repeatable use EITHER: the 'data_name" property, to label after a section data name OR the 'center' property to manually enter a string for the section label.
Parameters
Name Type Default Description secOptSecOpt inumber only for repeatables
Returns
Examples
//To label this section of the report after a section in the app use the data name of the section {"data_name": "inspection_details"}//To hardcode the section label to a text string use 'center' property instead {"center": "Inspection Details"}//Use 'prefix' and 'suffix' to hardcode additional text {"prefix":"Appendix: ", "center":"A - ", "suffix":"Observed Species"} //result = Appendix A - Observed Species {"prefix":VALUE('location') + ' - ', "data_name":"inspection_details"} //result = PL1 - Inspection Details//Repeatable Examples * {"rep_data_name":"followup_reporting", "data_name": "date_identified"} //Section result = Follow-up Reporting, Subsection result = ${date_identified} {"rep_data_name":"follow-up reporting", "data_name": "date_identified", "suffix":" - ", "lblIndex":true} //Section result = Follow-up Reporting, Subsection result = ${date_identified} - ${i}Details
-
buildYNSection( [ dn [, mflds [, secOpt ] ] ] ) → {string}
-
Description
Builds yesNo section using Merjent .yn-col stylesheet. Input either Section data name or MfldColl.
Parameters
Name Type Attributes Default Description dnstring <optional> '' mfldsMfldColl <optional> [] secOptObject <optional> {} Returns
Details
-
buildDefaultSection( dn, mflds, secOpt ) → {string}
Build an entire grid section using Merjent .grid-lo .default stylesheet.
-
Description
Input section data name or MfldColl.
buildDefaultSection > [mkMflds] > getSecHtml > getFormRows
Parameters
Name Type Default Description dnstring The data name of the section. If not provided, it will be determined from the field names.
mfldsMfldColl An array of field objects to be included in the section. If not provided, it will be determined from the field names.
secOptObject An optional object containing section options such as prefix, suffix, and other display settings.
Returns
-
buildRepeatableSubsec( repDn, mflds [, secOpt [, exc ] ] ) → {string}
Build an entire grid section using Merjent .grid-lo .default stylesheet.
-
Description
Input a repeatable section data name
buildRepeatableSubsec > [mkMflds] > getSecHtml > getFormRows
Parameters
Name Type Attributes Default Description repDnstring '' The data name of the repeatable section.
mfldsMfldColl [ mflds to include in the section.
secOptObject <optional> {} excArray.<string> <optional> [] Array of data names to exclude from the grid
Returns
-
photosRequestTagged( [ recIDs [, appID [, photoDn ] ] ] ) → {*}
Request photos with a caption beginning with '#'
-
Description
Request to pull only photos with a caption beginning with '#'
Use this to create photoOarr for input into buildPhotoSec() method.
Parameters
Name Type Attributes Default Description recIDsObject <optional> [''] appIDstring <optional> '' photoDnstring <optional> 'photos' Returns
-
photosRequest( recIDs, appID, photoDn [, orderDn [, qFlds ] ] ) → {Array}
Retrieves photos from a specified application based on record IDs.
-
Description
This function constructs a SQL query to select photos and their captions from a specified application, filtering by record IDs.
Parameters
Name Type Attributes Default Description recIDsArray.<string> Array of record IDs to retrieve photos for.
appIDString The ID of the application from which to retrieve photos.
photoDnString The data name of the photo field in the application.
orderDnString <optional> The data name of the field to order the results by. If null, no ordering is applied.
qFldsString <optional> '' Other columns to return, ie _record_id, _status
Returns
-
recordsRequest( recIDs, appID [, orderDn [, qFlds ] ] ) → {Array.<JSON>}
Request records from array of _record_id(s).
-
Parameters
Name Type Attributes Default Description recIDsArray.<string> Array of record IDs to retrieve.
appIDString The ID of the application from which to retrieve records.
orderDnString <optional> The data name of the field to order the results by. If null, no ordering is applied.
qFldsString <optional> Other columns to return, ie _record_id, _status
Returns
-
repRequestRecords( recIDs, appID, repID, parentDns, childDns, orderDn )
Request records from repeatable from array of _record_ids.
-
Description
Query uses inner join to match parent and child records.
Parameters
Name Type Default Description recIDs* appID* repID* parentDns* childDns* orderDn* Returns
-
makeTableHeaders( dns ) → {string}
Build html divs for table headers.
-
Parameters
Name Type Description dnsArray.<string> Returns
Details
-
addCH( dns, addCH ) → {string}
Rename child OR parent data_names for SQL query
-
Description
Adds 'CH.' to beginning of each data_name in array. Also adds 'PT.' to beginning of each dataname if addCH is false. Returns string of data_names for SQL query using INNERJOIN on a repeatable.
Parameters
Name Type Default Description dns* addCHboolean true true = add 'CH.' prefix, false = add 'PT.' prefix
Returns
-
formRequestSchema( appID )
Request form schema from Fulcrum API.
-
Description
Retrieves form fields from a specified application using the Fulcrum API.
Parameters
Name Type Description appID* Returns
Details
-
schema2Mflds( appFlds, dns ) → {MfldColl}
Create MfldColl from form schema and array of data names.
-
Parameters
Name Type Default Description appFlds* dns* Returns
-
photoRequestMeta( photo_id ) → {Object}
Retrieves the location information of a photo based on its photo_id.
-
Description
buildPhotoSection > getPhotoGrid1x3 > getPhotoWraped > getPhotoLoc
Parameters
Name Type Description photo_idstring The unique identifier of the photo.
Returns
-
photoAddItemNo( rows, fldName )
Adds photo number/label field to JSON rows.
-
Description
addItemNo > buildPhotoObjFromRows > buildPhotoSection > getPhotoGrid1x3 > getPhotoWraped > getPhotoLoc
Parameters
Name Type Default Description rowsArray A array of JSON rows returned from https request.
fldNamestring item_no The data name of the photo field to add to rows and enumerate.
Returns
-
photoObjFromRows( recs, dn [, photoLbl ] ) → {Object}
Builds a photo object from a https response.
-
Description
buildPhotoObjFromRows > buildPhotoSection > getPhotoGrid1x3 > getPhotoWraped > getPhotoLoc
Parameters
Name Type Attributes Default Description recsArray A array of JSON rows returned from https request.
dnstring The data name of the photo field in the rows.
photoLblstring <optional> 'item_no' The field name in rows that contains the photo number/label.
Returns
-
buildPhotoSection( photoOarr, secOpt, addXtra, label, firstpg ) → {string}
Builds a photo section with a grid layout for displaying photos in a report.
-
Description
buildPhotoSection > getPhotoGrid1x3 > getPhotoWraped > getPhotoLoc
Parameters
Name Type Default Description photoOarrArray An array of photo objects, each containing photo_id and caption properties.
secOptObject An optional object containing section options such as prefix, suffix, and other display settings.
addXtraboolean false A flag indicating whether to include additional fields in the photo display.
labelstring Fieldname to place above location and caption in photo margin
firstpgnumber 3 The index of where to page break on the first page of photos. Default is 3.
Returns
-
buildRepeatablePhotos( [ repDn [, photoDn [, secOpt ], addXtra ], label [, callback ] ] ) → {string}
Build photo section from photos in repeatable
-
Description
buildRepeatablePhotos > getPhotoGrid1x3 > getPhotoWraped > getPhotoLoc
Parameters
Name Type Attributes Default Description repDnstring <optional> '' photoDnstring <optional> '' secOptObject <optional> {} addXtraboolean false A flag indicating whether to include additional fields in the photo display.
labelstring Fieldname to place above location and caption in photo margin
callback* <optional> function to add fields to photo caption
Returns
-
photoRemTag( val ) → {string}
Removes # and ! from prefix of photo caption.
-
Description
Removes # and ! from prefix of photo caption.
Parameters
Name Type Description valstring Input caption string.
Returns
-
buildPhotoGrid1x3( photoOarr, secOpt, addXtra, firstpg ) → {string}
-
Description
Generates a 1x3 photo grid layout for displaying photos in a report.
Parameters
Name Type Default Description photoOarrArray An array of photo objects, each containing photo_id and caption properties.
secOptObject An optional object containing section options such as prefix, suffix, and other display settings.
addXtraboolean false A flag indicating whether to include additional fields in the photo display.
firstpgnumber 3 The index of where to page break on the first page of photos. Default is 3. (ie 1=after the first 2 photos and 2=after the first 3 photos)
Returns
-
photoAddCustomFields( [ photoObj ] ) → {string}
Returns html string of addon photo fields.
-
Description
Loop through additional addon photo properties and add to description. Ignores photo_id and caption properties.
Called from within getPhotoWraped to add additional custom fields besides caption to photo description if any are present.
Parameters
Name Type Attributes Default Description photoObjObject <optional> {} Returns
-
buildPhotoWrapper( [ photoObj [, addXtra [, photoLblFld ] ] ] ) → {string}
Constructs html for one photo with caption.
-
Description
Constructs html for one photo with caption and descriptive text.
Parameters
Name Type Attributes Default Description photoObjObject <optional> {} addXtraboolean <optional> false photoLblFldstring <optional> 'item_no' Returns
-
parsePhotoObj( [ dn [, dn [, addOnFlds ] ] ] ) → {Object}
Creates photo object from fields.
-
Description
Extracts Photo related properties from an Object (ie: row from Fulcrum Request) and creates a photo object array.
Use this before buildPhotoSection to create a photo array object to input.
Parameters
Name Type Attributes Default Description dnstring <optional> '' dn of field containing JSON array of data values (ie: summary records from datalink field)
dnstring <optional> '' dn in objDn containing photo_id values
addOnFldsObject <optional> [''] Returns
Details
-
rows2Divs( rows [, dns [, notes [, notesSpan [, naVal ] ] ] ] ) → {string}
Constructs html of object values separated by divs.
-
Description
Construct html of values from a obj. Input object and array of property names. Output values separated by divs. Optionally can display secified fields as a full width "notes" row if notes and notesSpan parameters are set.
Parameters
Name Type Attributes Default Description rowsArray.<Object> Array of row objects containing the data
dnsArray.<string> <optional> [''] Array of property names to extract from each row
notesArray.<string> <optional> [] Array of property names that should be formatted as notes
notesSpannumber <optional> 1 Number of columns a note should span
naValstring <optional> '---' Value to display when data is undefined
Returns
-
caption2Number( photoOarr, delimmiter [, numFld ] )
Find photo number in caption and place in separate field.
-
Description
Remove Photo Number from Caption and place in separate field while also stripping photo number from Caption. Photo number must be the first n characters of caption followed by a delimmeter that can be specified in the paramaters
Parameters
Name Type Attributes Default Description photoOarrObject photo Object array
delimmiterstring string separating photo number from remainder of caption
numFldstring <optional> 'photo_number' Label for add on Photo Number Label field, must be in "data name" format. ie(photo_number)
Examples
<% var photoFld_dn = 'photos' var sitePhotos = VALUE(photoFld_dn) caption2Number(sitePhotos,'.') //first characters of caption must be an identifier followed by '.' >% <%- M.buildPhotoSection(sitePhotos,{"prefix":"Appendix","center":$appendix},false,'photo_number') %> -
requestRLrecords( formID, vals, flds, orderDn ) → {*}
Not sure
-
Description
Description placeholder
Parameters
Name Type Description formIDstring valsArray.<{record_id:string}> array of record_id
fldsArray array of data_names
orderDnstring data_name of field to sort by
Returns
Details
-
buildSigTime() → {string}
Constructs html signature timestamp into two lines of date and time.
-
Description
Description placeholder
Returns
-
addSignatureTrim() → {string}
Trims signature image to signature.
-
Description
Html must have two img tags with ids of 'originalSignature' and 'trimmedSignature'.
Use example html below in html body and at end of body call addSignatureTrim() inside ejs tags.
Returns
Examples
<!- Signature Box WITH Agreement -> <div class="clump"> <div class="mjnt-sectionHeader spacer-top"> <%= LABEL('certification') %> </div> <div class="sig-sec"> <div> <%= FIELD('signature').agreement_text %> </div> <div > <div class="sig-container"> <img id="originalSignature" crossOrigin="anonymous" src="<%=`${SIGNATUREURL($signature && $signature.signature_id)}`%>" /> <img id="trimmedSignature" /> </div> <div><%= LABEL('signature') %></div> <div><%=M.fldVal('printed_name') %></div><div><%= LABEL('printed_name') %></div> <div><%=M.fldVal('title')%></div><div><%= LABEL('title') %></div> </div> </div> </div><!- Signature Line WITHOUT Agreement -> <div class="clump"> <div class="mjnt-sectionHeader spacer-top"> CIC APPROVAL </div> <div class="sig-line spacer-top"> <div class="row1"> <div><%=M.fldVal('signee')%></div> <div class="sig-container"> <img id="originalSignature" crossOrigin="anonymous" src="<%= $signature ? SIGNATUREURL($signature.signature_id) : '' %>" /> <img id="trimmedSignature" /> </div> <div><%=M.fldVal('decision_date')%></div> </div> <div class="row2"> <div>Name</div> <div>Signature</div> <div>Date</div> </div> </div> </div> -
optionIs( opt, option ) → {boolean|null}
Checks Mfld for options.
-
Description
Checks if a field option string contains a specific option. Current options supported: -rdo = radio buttons instead of checkboxes -cb = choice boxes (checkboxes) -hcb = horizontal choice boxes -syn = short yes no (first letter only) -yon = yes no only (no neutral option) -na = replace null values with 'N/A' instead of '---' -hn = hide null values (do not display field if value is null)
Parameters
Name Type Default Description optstring The option string (e.g., '-cb-hcb-rdo').
optionstring The option to check for (e.g., 'cb', 'hcb', 'rdo').
Returns
Details
-
mkMfld( dn [, span [, opt ] ] ) → {Mfld}
Make Merjent Field
-
Description
This function creates a Mfld object which possesess most of the properties as a fulcrum field with the addition of: span, opt
Parameters
Name Type Attributes Default Description dnstring Data name of the field.
spannumber <optional> 4 Span value for the field.
optstring <optional> Option string for the field.
Returns
Details
-
mkMflds( [ arr [, opt [, span ] ] ] ) → {MfldColl}
Make Merjent Fields
-
Description
make Mflds (array of Mfld)
Parameters
Name Type Attributes Default Description arrObject <optional> [] optstring <optional> spannumber <optional> 4 Returns
Details
-
spliceMflds( mflds [, dn [, key ], val ] )
Deprecated
-
Description
Description placeholder
Parameters
Name Type Attributes Default Description mfldsMfldColl dnstring <optional> '' keystring <optional> '' val* Details
-
fldVal( input [, i ] ) → {string}
Field Value
-
Description
This function returns the report HTML formatted value of a field. For null values default return is '---'.
Parameters
Name Type Attributes Default Description inputstring | Mfld field to be formatted. It can be a string of a data_name or a Mfld object.
inumber <optional> only used for repeatable values. index of the value in a repeatable field.
Returns
Examples
fldVal('inspector_name') // returns the value of the inspector_name fieldfldVal('inspector_name', 0) // returns the value of the inspector_name field in the first repeatable sectionDetails
-
getReportVal( [ dn [, mfld [, val ] ] ] ) → {*}
sub-function of fldVal
-
Description
Produces the html string of a field value based on its type and options after checking for repeatable values.
Parameters
Name Type Attributes Default Description dnstring <optional> '' mfld* <optional> val* <optional> val only needed for repeatable values
Returns
Details
-
customynBox( input [, val ] ) → {string}
Custiom Yes No Box
-
Description
get custom yn field as appropriate
opt = -syn | -yno | -rdo -syn only first letter of label (or 3 if neutral)
Parameters
Name Type Attributes Default Description inputstring | Mfld Mfld. Checks neutral_enabled. opt = optionIsShortYN | optionIsYonly | optionIsRadio
val* <optional> val is only used for yn boxes in a repeatable
Returns
Details
-
choiceBoxes( input [, val ] ) → {string}
Create list of checkboxes for choicevalues
-
Description
Creates an HTML string from a choice field with a list of checkboxes for choicevalues
opts = -hcb -hcb is horizontal choiceboxes, default is vertical choiceboxes.
Parameters
Name Type Attributes Default Description input* val* <optional> Returns
Details
-
devUnhide( event ) → {void}
Developer Unhide
-
Description
Sets all fields visible if USERROLE() == 'Owner'
Parameters
Name Type Description event* Returns
Details
-
devEdit( event ) → {void}
Developer Edit
-
Description
Sets all fields editable if USERROLE() == 'Owner'
Parameters
Name Type Description event* Returns
Details
-
setAllRO( [ bol [, exc [, sec ] ] ] ) → {void}
Set All Read-only
-
Description
Sets all fields to readonly or editable or default, except those in the exclude list or not in the section if specified.
Parameters
Name Type Attributes Default Description bolboolean <optional> false Set field to readonly, null sets to default.
excArray.<string> <optional> Array of datanames to exclude
secstring <optional> '' Restrict function to only data names in this section
Returns
Details
-
isMerjentEmail() → {boolean}
-
Description
Checks if current user email ends in'merjent.com'
Returns
Details
-
disableLocationEdit( event ) → {void}
-
Description
Disable editing location
Parameters
Name Type Description event* Returns
Details
-
userInit() → {string}
User Initials
-
Description
Gets current users initials
Returns
Details
-
getReportIDvars( [ reportDate ] ) → {Object}
Get Report ID Variables
-
Description
Get information pieces used to build report id
Parameters
Name Type Attributes Default Description reportDatestring <optional> Returns
Details
-
photoLandscape( event ) → {boolean}
Require photo to be taken landscape
-
Description
Validation for photo orientation, must be called from an ONCHANGE event of a photo field.
Parameters
Name Type Description event* Returns
Details
-
photoSetLoc( event ) → {void}
Photo Set Location
-
Description
Sets record location to the location of the first photo taken
Parameters
Name Type Description event* Returns
Details
-
clearRLAutoPops( event ) → {void}
Clear Record-Link Auto-populates
-
Description
If the value of the record-link field is null, on change, this data event will clear all of the auto-populate fields.
Parameters
Name Type Description event* Returns
Examples
ON('change', 'project_name', clearRLAutoPops)Details
-
popLatLon( [ dn ] ) → {string}
Populate Latitude Longitude
-
Description
For use in data event. Sets value of {data_name} to current lat/lon as a string "lat,lon". Alerts if no GPS info.
Parameters
Name Type Attributes Default Description dnstring <optional> output field data name to write to
Returns
Details
-
photoCheck4Caps( dn ) → {boolean}
Photo Check for Captions
-
Description
Checks photofield for photos without a caption. Returns an Alert.
Parameters
Name Type Description dnstring Returns
Details
-
photoCheckCapLen( dn, max ) → {void}
Photo Check Caption Length
-
Description
Description placeholder
Parameters
Name Type Description dnstring maxnumber Returns
Details
-
makeDnsRow( dns [, exc ] ) → {Object}
Make data_names Row
-
Description
Creates an object from a list of data names. Excludes Labels, Sections and HyperlinkFields.
Parameters
Name Type Attributes Default Description dns* excArray.<string> <optional> [] Returns
Details
-
makeRepRows( repeatableDn [, exc ] ) → {Array.<Object>}
Make Repeatable Rows
-
Description
Converts a repeatable to an Array of Objects. Input repeatable data name.
Parameters
Name Type Attributes Default Description repeatableDnstring excArray.<string> <optional> [] Returns
Details
-
rows2Summary( rows [, exc ] ) → {Array.<string>}
Rows to Summary
-
Description
Converts an array of objects to an array of summary strings, excluding specified keys. Each summary string lists key-value pairs separated by commas.
Parameters
Name Type Attributes Default Description rowsArray.<Object> Array of objects to summarize.
excArray.<string> <optional> [] Array of keys to exclude from summary.
Returns
Details
-
fv2DnRows( rows, dict ) → {Array.<Object>}
Form Values to Data Names Rows
-
Description
Converts an array of Fulcrum rows to an array of objects with data names as keys. Uses a dictionary to map form_value keys to data names.
Parameters
Name Type Description rowsArray.<Object> Array of Fulcrum record objects.
dictObject Dictionary mapping form_value keys to data names.
Returns
Details
-
loadRecords( arr, formID, callback ) → {void}
Load Records
-
Description
Wrapper function for LOADRECORDS() expression.
Parameters
Name Type Description arrArray.<string> formIDstring callbackfunction function to process records and store them to a variable or field. Callback must have one parameter for records. See example.
Returns
Examples
processRecordsCallback(records){ loadedRecords = convertFV2DN(records,loadedFvs) var out = [] for(const record of loadedRecords){ var add = record.scientific_name + ' - ' + record.common_name out.push(add) } SETVALUE('result',out.join('\n')) } M.loadRecords(recIDs,appID,processRecordsCallback)Details
-
getRepDn( dn ) → {string}
Get Repeatable Parent
-
Description
get parent data_name for a field. Returns only the next parent that is a repeatable.
Parameters
Name Type Description dnstring Returns
Examples
getRepDn('inspector_name') // returns 'background'Details
-
digElement( el, collector ) → {void}
Dig Element
-
Description
Recursively collects all data_name:form_value pairs from element. Adds element to collector array. Primarily used as a sub-function within makeFvDict.
Parameters
Name Type Description elObject The parent element to start from.
collectorobject The object to collect elements into.
Returns
Details
-
makeFvDict( form ) → {Object}
Make Form Values Dictionary
-
Description
Input a fulcrum form schema Object and returns a dictionary object of {data_name:form_value}.
Parameters
Name Type Description formObject Fulcrum form schema object.
Returns
Details
-
mkLocalFvDict( el ) → {Object}
Make Local Form Values Dictionary
-
Description
Creates a local dictionary of {form_value:data_name} for fields within the specified element or the entire form if no element is provided.
Parameters
Name Type Default Description elObject | null Fulcrum form element object. If null, uses the entire form.
Returns
Details
-
repeatable2jrows( repDn [, exc ] ) → {Array.<Object>}
Repeatable to JSON Rows
-
Description
Converts a repeatable field's value into an array of objects with data names as keys.
Parameters
Name Type Attributes Default Description repDnstring Data name of the repeatable field.
excArray.<string> <optional> [] Array of data names to exclude.
Returns
Details
-
loadForm( formID, callback ) → {void}
-
Description
Description placeholder
Parameters
Name Type Description formIDstring fulcrum form id
callbackfunction function to process form schema
Returns
Examples
processFormCallback(form){ loadedFvs = M.flipKVpair(this.makeFvDict(form)) } M.loadForm(formID,processFormCallback)Details
-
eachSecDn( secDn, callback ) → {void}
Each Section Data Name
-
Description
Performs callback function on each data name in a section.
Parameters
Name Type Description secDnstring Section data name.
callbackfunction Function to perform for each data name.
Returns
Details
-
clear( dn ) → {void}
-
Description
Clears value in fulcrum field.
Parameters
Name Type Description dnstring Data name to clear.
Returns
Details
-
getRepeatableValues( repVals, dnFv ) → {Object}
-
Description
Description placeholder
Parameters
Name Type Description repVals* this is from VALUE(repeatable data name)
dnFvstring Returns
Details
-
getNestedRepeatable( parentDn, childDn, dnFv ) → {Object}
-
Description
Description placeholder
Parameters
Name Type Description parentDnstring childDnstring dnFvstring Returns
Details
-
timedProcessingMsg( time ) → {void}
Timed Processing Message
-
Description
block input into form with an alert message for a set time in milliseconds.
Parameters
Name Type Description timenumber milliseconds for settimeout
Returns
Details
-
valProcessingMsg( dn, time ) → {void}
Value Processing Message
-
Description
block input into form with an alert message until a value is present in the specified data name or until a settimeout.
Parameters
Name Type Description dnstring timenumber milliseconds for settimeout
Returns
Details
-
mkPhotoDirHandler( photoFldDn [, photoDirDn [, photoCardDn [, secondary ] ] ] ) → {PhotoDirHandler}
-
Description
Factory method for PhotoDirHandler (backward compatibility)
Parameters
Name Type Attributes Default Description photoFldDnstring Photo field data name
photoDirDnstring <optional> "" Direction field data name (degrees)
photoCardDnstring <optional> "" Cardinal direction field data name
secondaryboolean <optional> false Use 16-point compass if true, 8-point if false
Returns
Examples
const photoDirObj = M.mkPhotoDirHandler('photo_field', 'direction_deg', 'direction_cardinal') function changeDir(event){ photoDirObj.popOther(event) } ON('change', photoDirObj.dnDir, changeDir) ON('change', photoDirObj.dnCard, changeDir) ON('add-photo', photoDirObj.photoDn, photoDirObj.extractPhotoDir)Details
-
mkMLoadRecords( formID, enterLoadedData [, fulcrumHelpers ] ) → {MLoadRecords}
-
Description
Factory method for MLoadRecords (backward compatibility)
Parameters
Name Type Attributes Default Description formIDstring Fulcrum form ID
enterLoadedDatafunction Callback function to process loaded records
fulcrumHelpersFulcrumHelpers <optional> this Optional helper instance (defaults to current FulcrumHelpers instance)
Returns
Examples
const appID = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' function processRecords() { const loadedRecords = loader.appRecords const titleList = loadedRecords.map(x => x.scientific_name + ' - ' + x.common_name) SETVALUE('result', titleList.join('\n')) } const loader = M.mkMLoadRecords(appID, processRecords) ON('load-record', loader.getAppFvs) ON('change', 'species_link', loader.loadRecords)Details