Skip to main content

Form Utils

utils

Here is the list of available variables you can use while writing Javascript.

Access ControllerVariableDescription
publicChoicesWrapperChoicesWrapper
publicI18nThis file is used to mimic the i18n library interface.
publiccheckInvalidDate(value: String, format: String, maxDate: Date, minDate: Date): *Checks the entered date for validity.
publiclessOrGreater(value: moment, format: String, maxDate: Date, minDate: Date): {"message": , "result": }Checks the value for a min date and max date.
publicapplyFormChanges(form: , changes: ): {"form": , "failed": }Checks the value for a min date and max date.
publiceachComponent(components: Object, fn: Function, includeAll: Boolean, path: String, parent: Object)Iterate through each component within a form.
publicescapeRegExCharacters(value: String): stringEscapes RegEx characters in provided String value.
publicfindComponent(components: , key: , fn: , path: ): *This function will find a component in a form and return the component AND THE PATH to the component in the form.
publicfindComponents(components: , query: ): *Deprecated version of findComponents.
publicflattenComponents(components: Object, includeAll: Boolean): ObjectFlatten the form components for data manipulation.
publicformatAsCurrency(value: any): StringFormats provided value in how the Currency component uses it.
publicgenerateFormChange(type: , data: ): *
publicgetComponent(components: Object, key: StringObject): Object
publicgetStrings(form: ): Iterate over all components in a form and get string values for translation.
publicgetValue(submission: Object, key: String): *Get the value for a component key in the given submission.
publichasCondition(component: *): booleanReturns if this component has a conditional statement.
publicisLayoutComponent(component: Object): BooleanDetermine if a component is a layout component.
publicmatchComponent(component: , query: ): booleanMatches if a component matches the query
publicparseFloatExt(value: any): NumberExtension of standard #parseFloat(value) function, that also clears input string.
publicremoveComponent(components: , path: )Remove a component by path.
publicsearchComponents(components: , query: ): *Finds a component provided a query of properties of that component.
publicKEY_CODES: {"BACK_KEY": number, "DELETE_KEY": number, "TAB_KEY": number, "ENTER_KEY": number, "A_KEY": number, "ESC_KEY": number, "UP_KEY": number, "DOWN_KEY": number, "PAGE_UP_KEY": number, "PAGE_DOWN_KEY": number}
publicEvaluator: {"noeval": , "protectedEval": , "cache": , "templateSettings": , "evaluator": *, "template": function, "interpolate": function, "evaluate": function}
publicCALENDAR_ERROR_MESSAGES: {"INVALID": string, "INCOMPLETE": string, "greater": function, "less": function}