Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
this.allowSubmission(Boolean)

this.changeFormValue(field_name, new_value)

this.enableField(field_name, Boolean)

this.disableField(field_name)

this.mandatoryField(field_name, Boolean)

this.changeInputValue(field_name, value)

this.hideOutputField(["field_name1", "field_name2"],"template_name")

this.unHideOutputField(["field_name1", "field_name2"],"template_name")

this.hideInputField(["field_name1", "field_name2"],"template_name")

this.unHideInputField(["field_name1", "field_name2"],"template_name")

this.hideUserBulkTaskButtons(["button 1 name", "button 2 name", …n])

this.unHideUserBulkTaskButtons(["button 1 name", "button 2 name", …n])

let value =  JSON.stringify(finalValues)
this.updateAnnotations(value)

let errorMsgs = []if(errorMsgs.length > 0) {
  this.displayErrors(errorMsgs)
  this.disAllowSubmit(true)
} else {  
  this.disAllowSubmit(false)
}

this.changeAnnotationClasses(newClass);

let inputText = inputValues[field_name]

let currentUserId = localStorage.getItem("userId")
if(currentUserLevel === 1) {  
  this.changeFormValue(field_name, `${currentUserId}`)
}

For NER: 
let entities = _.get(annotations, "[0].value.annotations.entities", _.get(annotations, "annotations.entities", []))

To access form values in On-Change/on-Validation/On-save(also console the values coming from values and formValues then use as required):
  let fieldNameValue = values["field_name"]

To access previous values in the on change code: (Useful to check if a particular field's value has changed')
  let preValues = oldValues["field_name"]
  
To access annotations data in any annotation project
  let anns = annotations
  

...

Code Block
languagejs
let lineItems = []
let i = 0
/* To generate two empty rows */
while(i < 2) {
    lineItems.push({
        "weight": "",
        "unit": ""
      })
      i += 1
  }
/* Variant is the field name */
if(Array.isArray(lineItems)){
  this.changeFormValue("Variant", JSON.stringify(lineItems))
}
  1. Calculation of IOU at level 3 for rejection logic

...