API documentation automatically generated by docmeteor.
File: "utility.js" Where: {client}
This method is private
This method cleanNulls is defined in Utility
Arguments
- doc {Object}
Source object
Returns {Object}
Returns an object in which all properties with null, undefined, or empty string values have been removed, recursively.
cleanNulls: function cleanNulls(doc, isArray, keepEmptyStrings) { ...
utility.js:11
This method is private
This method reportNulls is defined in Utility
Arguments
- flatDoc {Object}
An object with no properties that are also objects.
Returns {Object} An object in which the keys represent the keys in the
original object that were null, undefined, or empty strings, and the value of each key is "".
reportNulls: function reportNulls(flatDoc, keepEmptyStrings) { ...
utility.js:40
This method is private
This method docToModifier is defined in Utility
Arguments
- doc {Object}
An object to be converted into a MongoDB modifier
Returns {Object} A MongoDB modifier.
Converts an object into a modifier by flattening it, putting keys with
null, undefined, and empty string values into modifier.$unset
, and
putting the rest of the keys into modifier.$set
.
docToModifier: function docToModifier(doc, keepEmptyStrings) { ...
utility.js:69
This method is private
This method getSelectValues is defined in Utility
Arguments
- select {Element}
DOM Element from which to get current values
Returns {string[]}
Gets a string array of all the selected values in a given select
DOM element.
getSelectValues: function getSelectValues(select) { ...
utility.js:96
This method is private
This method maybeNum is defined in Utility
Arguments
- val {string}
Returns {String|Number}
If the given string can be converted to a number, returns the number. Otherwise returns the string.
maybeNum: function maybeNum(val) { ...
utility.js:119
This method is private
This method lookup is defined in Utility
Arguments
- obj {Any}
Returns {Any}
If obj
is a string, returns the value of the property with that
name on the window
object. Otherwise returns obj
.
lookup: function lookup(obj) { ...
utility.js:137
This method is private
This method getDefs is defined in Utility
Arguments
- ss {SimpleSchema}
- name {String}
Returns {Object} Schema definitions object
Returns the schema definitions object from a SimpleSchema instance. Equivalent to calling
ss.schema(name)
but handles throwing errors if name
is not a string or is not a valid
field name for this SimpleSchema instance.
getDefs: function getDefs(ss, name) { ...
utility.js:160
This method is private
This method objAffectsKey is defined in Utility
Arguments
- {Object} {any}
obj
- {String} {any}
key
Returns {Boolean}
TODO
* should make this a static method in MongoObject
objAffectsKey: function objAffectsKey(obj, key) { ...
utility.js:178
This method is private
This method expandObj is defined in Utility
Arguments
- {Object} {any}
doc
Returns {Object}
Takes a flat object and returns an expanded version of it.
expandObj: function expandObj(doc) { ...
utility.js:190
This method is private
This method compactArrays is defined in Utility
Arguments
- {Object} {any}
obj
Returns {undefined}
Edits the object by reference, compacting any arrays at any level recursively.
compactArrays: function compactArrays(obj) { ...
utility.js:227
This method is private
This method bubbleEmpty is defined in Utility
Arguments
- {Object} {any}
obj
Returns {undefined}
Edits the object by reference.
bubbleEmpty: function bubbleEmpty(obj, keepEmptyStrings) { ...
utility.js:250
This method is private
This method getSimpleSchemaFromContext is defined in Utility
Arguments
- {Object} {any}
context
Returns {SimpleSchema}
Given a context object that may or may not have schema and collection properties, returns a SimpleSchema instance or throws an error if one cannot be obtained.
getSimpleSchemaFromContext: function getSimpleSchemaFromContext(context, formId) { ...
utility.js:280
This method is private
This method isNullUndefinedOrEmptyString is defined in Utility
Arguments
- {Any} {any}
val
Returns {Boolean}
Returns true
if the value is null, undefined, or an empty string
isNullUndefinedOrEmptyString: function isNullUndefinedOrEmptyString(val) { ...
utility.js:314
This method is private
This method isValidDateString is defined in Utility
Arguments
- {String} {any}
dateString
Returns {Boolean}
Returns true
if dateString is a "valid date string"
isValidDateString: function isValidDateString(dateString) { ...
utility.js:325
This method is private
This method isValidTimeString is defined in Utility
Arguments
- {String} {any}
timeString
Returns {Boolean}
Returns true
if timeString is a "valid time string"
isValidTimeString: function isValidTimeString(timeString) { ...
utility.js:337
This method is private
Arguments
- {Date} {any}
date
Returns {String}
Returns a "valid date string" representing the local date.
dateToDateString: function dateToDateString(date) { ...
utility.js:354
This method is private
Arguments
- {Date} {any}
date
Returns {String}
Returns a "valid date string" representing the date converted to the UTC time zone.
dateToDateStringUTC: function dateToDateStringUTC(date) { ...
utility.js:373
This method is private
Arguments
- {Date} {any}
date
Returns {String}
Returns a "valid normalized forced-UTC global date and time string" representing the time converted to the UTC time zone and expressed as the shortest possible string for the given time (e.g. omitting the seconds component entirely if the given time is zero seconds past the minute).
http: http:
dateToNormalizedForcedUtcGlobalDateAndTimeString: function dateToNormalizedForcedUtcGlobalDateAndTimeString(date) { ...
utility.js:397
This method is private
Arguments
- {String} {any}
dateString
Returns {Boolean}
Returns true if dateString is a "valid normalized forced-UTC global date and time string"
isValidNormalizedForcedUtcGlobalDateAndTimeString: function isValidNormalizedForcedUtcGlobalDateAndTimeString(dateString) { ...
utility.js:408
This method is private
This method dateToNormalizedLocalDateAndTimeString is defined in Utility
Arguments
- date {Date}
- offset {String}
A valid offset string (to pass to moment.zone)
Returns {String}
Returns a "valid normalized local date and time string".
dateToNormalizedLocalDateAndTimeString: function dateToNormalizedLocalDateAndTimeString(date, offset) { ...
utility.js:427
This method is private
Arguments
- {String} {any}
dtString
Returns {Boolean}
Returns true if dtString is a "valid normalized local date and time string"
isValidNormalizedLocalDateAndTimeString: function isValidNormalizedLocalDateAndTimeString(dtString) { ...
utility.js:440
This method is private
This method normalizeContext is defined in Utility
Arguments
- {Object} {any}
context A context object, potentially with an atts
or autoform
property.
- name {String}
The name of the helper or component we're calling from, for in a potential error message.
Returns {Object} Normalized context object
Returns an object with afc
, af
, and atts
properties, normalized from whatever object is passed in.
This helps deal with the fact that we have to pass the ancestor autoform's context to different
helpers and components in different ways, but in all cases we want to get access to it and throw
an error if we can't find an autoform context.
normalizeContext: function autoFormNormalizeContext(context, name) { ...
utility.js:461
This method is private
This method stringToArray is defined in Utility
Arguments
- A {String|Array}
variable that might be a string or an array.
Returns {Array} The array, building it from a comma-delimited string if necessary.
stringToArray: function stringToArray(s, errorMessage) { ...
utility.js:512
Tests whether "obj" is an Object as opposed to
something that inherits from Object
This method is private
Arguments
- obj {any}
Returns {Boolean}
var isBasicObject = function(obj) { ...
utility.js:544
File: "form-preserve.js" Where: {client}
This method is private
Arguments
- migrationName {String}
Internal helper object to preserve form inputs across Hot Code Push and across "pages" navigation if the option is enabled.
FormPreserve = function formPreserveConstructor(migrationName) { ...
form-preserve.js:9
File: "autoform.js" Where: {client}
Gets the value that should be shown/selected in the input. Returns
a string, a boolean, or an array of strings. The value used,
in order of preference, is one of:
The `value` attribute provided
The value that is set in the `doc` provided on the containing autoForm
The `defaultValue` from the schema
function getInputValue(name, atts, expectsArray, inputType, value, mDoc, defaultValue) { ...
autoform.js:532
File: "autoform-api.js" Where: {client}
This method addHooks is defined in AutoForm
Arguments
- formIds {String[]|String|null}
Form id
or array of form IDs to which these hooks apply. Specify null
to add hooks that will run for every form.
- hooks {Object}
Hooks to add, where supported names are "before", "after", "formToDoc", "docToForm", "onSubmit", "onSuccess", and "onError".
Returns {undefined}
Defines hooks to be used by one or more forms. Extends hooks lists if called multiple times for the same form.
AutoForm.addHooks = function autoFormAddHooks(formIds, hooks, replace) { ...
autoform-api.js:13
This method hooks is defined in AutoForm
Arguments
- hooks {Object}
Returns {undefined}
Defines hooks by form id. Extends hooks lists if called multiple times for the same form.
AutoForm.hooks = function autoFormHooks(hooks, replace) { ...
autoform-api.js:51
This method resetForm is defined in AutoForm
Arguments
- formId {String}
- template {TemplateInstance} (Optional)
Looked up if not provided. Pass in for efficiency.
Returns {undefined}
Resets an autoform, including resetting validation errors. The same as clicking the reset button for an autoform.
AutoForm.resetForm = function autoFormResetForm(formId, template) { ...
autoform-api.js:66
This method setDefaultTemplate is defined in AutoForm
Arguments
- template {String}
AutoForm.setDefaultTemplate = function autoFormSetDefaultTemplate(template) { ...
autoform-api.js:78
This method getDefaultTemplate is defined in AutoForm
Reactive.
AutoForm.getDefaultTemplate = function autoFormGetDefaultTemplate() { ...
autoform-api.js:89
This method setDefaultTemplateForType is defined in AutoForm
Arguments
- type {String}
- template {String}
AutoForm.setDefaultTemplateForType = function autoFormSetDefaultTemplateForType(type, template) { ...
autoform-api.js:100
This method getDefaultTemplateForType is defined in AutoForm
Arguments
- type {String}
Returns {String} Template name
Reactive.
AutoForm.getDefaultTemplateForType = function autoFormGetDefaultTemplateForType(type) { ...
autoform-api.js:119
This method getFormValues is defined in AutoForm
Arguments
- formId {String}
The id
attribute of the autoForm
you want current values for.
Returns {Object}
Returns an object representing the current values of all schema-based fields in the form. The returned object contains two properties, "insertDoc" and "updateDoc", which represent the field values as a normal object and as a MongoDB modifier, respectively.
AutoForm.getFormValues = function autoFormGetFormValues(formId) { ...
autoform-api.js:137
This method getFieldValue is defined in AutoForm
Arguments
- formId {String}
The id
attribute of the autoForm
you want current values for.
- fieldName {String}
The name of the field for which you want the current value.
Returns {Any}
Returns the value of the field (the value that would be used if the form were submitted right now). This is a reactive method that will rerun whenever the current value of the requested field changes.
AutoForm.getFieldValue = function autoFormGetFieldValue(formId, fieldName) { ...
autoform-api.js:159
This method inputValueHandlers is defined in AutoForm
Arguments
- handlers {Object}
An object defining one or more selectors with corresponding handler function.
Returns {undefined}
Use this method to add custom input value handlers, which will be checked before the built-in handlers.
AutoForm.inputValueHandlers = function afInputValueHandlers(handlers) { ...
autoform-api.js:175
This method validateField is defined in AutoForm
Arguments
- formId {String}
The id
attribute of the autoForm
you want to validate.
- fieldName {String}
The name of the field within the autoForm
you want to validate.
- skipEmpty {Boolean} (Optional, Default = false)
Set to true
to skip validation if the field has no value. Useful for preventing required
errors in form fields that the user has not yet filled out.
Returns {Boolean} Is it valid?
In addition to returning a boolean that indicates whether the field is currently valid, this method causes the reactive validation messages to appear.
AutoForm.validateField = function autoFormValidateField(formId, fieldName, skipEmpty) { ...
autoform-api.js:190
This method validateForm is defined in AutoForm
Arguments
- formId {String}
The id
attribute of the autoForm
you want to validate.
Returns {Boolean} Is it valid?
In addition to returning a boolean that indicates whether the form is currently valid, this method causes the reactive validation messages to appear.
AutoForm.validateForm = function autoFormValidateForm(formId) { ...
autoform-api.js:208
This method getValidationContext is defined in AutoForm
Arguments
- formId {String}
The id
attribute of the autoForm
for which you want the validation context
Returns {SimpleSchemaValidationContext} The SimpleSchema validation context object.
Use this method to get the validation context, which can be used to check the current invalid fields, manually invalidate fields, etc.
AutoForm.getValidationContext = function autoFormGetValidationContext(formId) { ...
autoform-api.js:241
This method find is defined in AutoForm
Returns {Object} The data context for the closest autoform.
Call this method from a UI helper to get the data context for the closest autoform.
AutoForm.find = function autoFormFind(type) { ...
autoform-api.js:256
This method debug is defined in AutoForm
Call this method in client code while developing to turn on extra logging.
AutoForm.debug = function autoFormDebug() { ...
autoform-api.js:273