You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*This method __getFormValues__ is defined in `AutoForm`*
227
227
@@ -239,15 +239,18 @@ __Arguments__
239
239
240
240
The SimpleSchema instance, if already known, as a performance optimization.
241
241
242
+
*__getModifier__*{Boolean}* (Optional)
243
+
244
+
Set to `true` to return a modifier object or `false` to return a normal object. For backwards compatibility, and object containing both is returned if this is undefined.
245
+
242
246
243
247
__Returns__*{Object}*
244
248
245
249
246
250
Returns an object representing the current values of all schema-based fields in the form.
247
-
The returned object contains two properties, "insertDoc" and "updateDoc", which represent
248
-
the field values as a normal object and as a MongoDB modifier, respectively.
251
+
The returned object is either a normal object or a MongoDB modifier, based on the `getModifier` argument.
249
252
250
-
> ```AutoForm.getFormValues = function autoFormGetFormValues(formId, template, ss) { ...```[autoform-api.js:266](autoform-api.js#L266)
253
+
> ```AutoForm.getFormValues = function autoFormGetFormValues(formId, template, ss, getModifier) { ...```[autoform-api.js:266](autoform-api.js#L266)
251
254
252
255
253
256
-
@@ -273,7 +276,7 @@ __Returns__ *{Any}*
273
276
Returns the value of the field (the value that would be used if the form were submitted right now).
274
277
This is a reactive method that will rerun whenever the current value of the requested field changes.
275
278
276
-
> ```AutoForm.getFieldValue = function autoFormGetFieldValue(fieldName, formId) { ...```[autoform-api.js:386](autoform-api.js#L386)
279
+
> ```AutoForm.getFieldValue = function autoFormGetFieldValue(fieldName, formId) { ...```[autoform-api.js:409](autoform-api.js#L409)
277
280
278
281
279
282
-
@@ -294,7 +297,7 @@ __Returns__ *{String}*
294
297
295
298
Returns the name of the template used to render the element.
296
299
297
-
> ```AutoForm.getInputTypeTemplateNameForElement = function autoFormGetInputTypeTemplateNameForElement(element) { ...```[autoform-api.js:413](autoform-api.js#L413)
300
+
> ```AutoForm.getInputTypeTemplateNameForElement = function autoFormGetInputTypeTemplateNameForElement(element) { ...```[autoform-api.js:437](autoform-api.js#L437)
298
301
299
302
300
303
-
@@ -320,7 +323,7 @@ __Returns__ *{Any}*
320
323
Returns the value of the field (the value that would be used if the form were submitted right now).
321
324
Unlike `AutoForm.getFieldValue`, this function is not reactive.
322
325
323
-
> ```AutoForm.getInputValue = function autoFormGetInputValue(element, ss) { ...```[autoform-api.js:441](autoform-api.js#L441)
326
+
> ```AutoForm.getInputValue = function autoFormGetInputValue(element, ss) { ...```[autoform-api.js:465](autoform-api.js#L465)
324
327
325
328
326
329
-
@@ -349,7 +352,7 @@ __Returns__ *{undefined}*
349
352
350
353
Use this method to add custom input components.
351
354
352
-
> ```AutoForm.addInputType = function afAddInputType(name, definition) { ...```[autoform-api.js:527](autoform-api.js#L527)
355
+
> ```AutoForm.addInputType = function afAddInputType(name, definition) { ...```[autoform-api.js:555](autoform-api.js#L555)
353
356
354
357
355
358
-
@@ -398,7 +401,7 @@ __Returns__ *{undefined}*
398
401
399
402
Use this method to add custom form types.
400
403
401
-
> ```AutoForm.addFormType = function afAddFormType(name, definition) { ...```[autoform-api.js:548](autoform-api.js#L548)
404
+
> ```AutoForm.addFormType = function afAddFormType(name, definition) { ...```[autoform-api.js:576](autoform-api.js#L576)
402
405
403
406
404
407
-
@@ -429,7 +432,7 @@ Is it valid?
429
432
In addition to returning a boolean that indicates whether the field is currently valid,
430
433
this method causes the reactive validation messages to appear.
431
434
432
-
> ```AutoForm.validateField = function autoFormValidateField(formId, fieldName, skipEmpty) { ...```[autoform-api.js:565](autoform-api.js#L565)
435
+
> ```AutoForm.validateField = function autoFormValidateField(formId, fieldName, skipEmpty) { ...```[autoform-api.js:593](autoform-api.js#L593)
433
436
434
437
435
438
-
@@ -452,7 +455,7 @@ Is it valid?
452
455
In addition to returning a boolean that indicates whether the form is currently valid,
453
456
this method causes the reactive validation messages to appear.
454
457
455
-
> ```AutoForm.validateForm = function autoFormValidateForm(formId) { ...```[autoform-api.js:583](autoform-api.js#L583)
458
+
> ```AutoForm.validateForm = function autoFormValidateForm(formId) { ...```[autoform-api.js:611](autoform-api.js#L611)
456
459
457
460
458
461
-
@@ -475,7 +478,7 @@ The SimpleSchema validation context object.
475
478
Use this method to get the validation context, which can be used to check
476
479
the current invalid fields, manually invalidate fields, etc.
477
480
478
-
> ```AutoForm.getValidationContext = function autoFormGetValidationContext(formId) { ...```[autoform-api.js:599](autoform-api.js#L599)
481
+
> ```AutoForm.getValidationContext = function autoFormGetValidationContext(formId) { ...```[autoform-api.js:645](autoform-api.js#L645)
479
482
480
483
481
484
-
@@ -497,7 +500,7 @@ Searches for the given attribute, looking up the parent context tree until the c
497
500
498
501
Call this method from a UI helper. Might return undefined.
499
502
500
-
> ```AutoForm.findAttribute = function autoFormFindAttribute(attrName) { ...```[autoform-api.js:612](autoform-api.js#L612)
503
+
> ```AutoForm.findAttribute = function autoFormFindAttribute(attrName) { ...```[autoform-api.js:658](autoform-api.js#L658)
501
504
502
505
503
506
-
@@ -519,7 +522,7 @@ An object containing all of the found attributes and their values, with the pref
519
522
520
523
Call this method from a UI helper. Searches for attributes that start with the given prefix, looking up the parent context tree until the closest autoform is reached.
521
524
522
-
> ```AutoForm.findAttributesWithPrefix = function autoFormFindAttributesWithPrefix(prefix) { ...```[autoform-api.js:658](autoform-api.js#L658)
525
+
> ```AutoForm.findAttributesWithPrefix = function autoFormFindAttributesWithPrefix(prefix) { ...```[autoform-api.js:699](autoform-api.js#L699)
523
526
524
527
525
528
-
@@ -532,7 +535,7 @@ Call this method from a UI helper. Searches for attributes that start with the g
532
535
Call this method in client code while developing to turn on extra logging.
533
536
You need to call it just one time, usually in top level client code.
534
537
535
-
> ```AutoForm.debug = function autoFormDebug() { ...```[autoform-api.js:707](autoform-api.js#L707)
538
+
> ```AutoForm.debug = function autoFormDebug() { ...```[autoform-api.js:743](autoform-api.js#L743)
536
539
537
540
538
541
-
@@ -542,7 +545,7 @@ You need to call it just one time, usually in top level client code.
542
545
*This property __arrayTracker__ is defined in `AutoForm`*
*This method __viewForForm__ is defined in `AutoForm`*
665
+
666
+
__Arguments__
667
+
668
+
*__formId__*{String}* (Optional)
669
+
670
+
The form's `id` attribute. Do not pass this if calling from within a form context.
671
+
672
+
673
+
__Returns__*{Blaze.View}*
674
+
The `Blaze.View` instance for the autoForm. Always returns the view or throws an error.
675
+
676
+
677
+
Gets the `Blaze.View` instance for the form with formId or the closest form to the current context.
678
+
679
+
> ```AutoForm.viewForForm = function (formId) { ...```[autoform-api.js:939](autoform-api.js#L939)
655
680
656
681
657
682
-
@@ -679,7 +704,7 @@ Looks in the document attached to the form to see if the
679
704
requested field exists and is an array. If so, returns the
680
705
length (count) of the array. Otherwise returns undefined.
681
706
682
-
> ```AutoForm.getArrayCountFromDocForField = function (formId, field) { ...```[autoform-api.js:928](autoform-api.js#L928)
707
+
> ```AutoForm.getArrayCountFromDocForField = function (formId, field) { ...```[autoform-api.js:978](autoform-api.js#L978)
683
708
684
709
685
710
-
@@ -704,7 +729,7 @@ or throws an error.
704
729
You can call this without a formId from within a helper and
705
730
the data for the nearest containing form will be returned.
706
731
707
-
> ```AutoForm.getCurrentDataForForm = function (formId) { ...```[autoform-api.js:951](autoform-api.js#L951)
732
+
> ```AutoForm.getCurrentDataForForm = function (formId) { ...```[autoform-api.js:1001](autoform-api.js#L1001)
708
733
709
734
710
735
-
@@ -729,7 +754,7 @@ Always returns an object or throws an error.
729
754
You can call this without a formId from within a helper and
730
755
the data for the nearest containing form will be returned.
731
756
732
-
> ```AutoForm.getCurrentDataPlusExtrasForForm = function (formId) { ...```[autoform-api.js:992](autoform-api.js#L992)
757
+
> ```AutoForm.getCurrentDataPlusExtrasForForm = function (formId) { ...```[autoform-api.js:1016](autoform-api.js#L1016)
733
758
734
759
735
760
-
@@ -751,7 +776,7 @@ The Collection instance
751
776
752
777
Gets the collection for a form from the `collection` attribute
753
778
754
-
> ```AutoForm.getFormCollection = function (formId) { ...```[autoform-api.js:1015](autoform-api.js#L1015)
779
+
> ```AutoForm.getFormCollection = function (formId) { ...```[autoform-api.js:1039](autoform-api.js#L1039)
755
780
756
781
757
782
-
@@ -780,7 +805,7 @@ provided, or from the schema attached to the `Mongo.Collection`
780
805
specified in the `collection` attribute. The form must be
781
806
currently rendered.
782
807
783
-
> ```AutoForm.getFormSchema = function (formId, form) { ...```[autoform-api.js:1032](autoform-api.js#L1032)
808
+
> ```AutoForm.getFormSchema = function (formId, form) { ...```[autoform-api.js:1056](autoform-api.js#L1056)
784
809
785
810
786
811
-
@@ -795,7 +820,7 @@ The containing form's `id` attribute value
795
820
796
821
Call in a helper to get the containing form's `id` attribute. Reactive.
797
822
798
-
> ```AutoForm.getFormId = function () { ...```[autoform-api.js:1044](autoform-api.js#L1044)
823
+
> ```AutoForm.getFormId = function () { ...```[autoform-api.js:1068](autoform-api.js#L1068)
799
824
800
825
801
826
-
@@ -820,7 +845,7 @@ __Returns__ *{undefined}*
820
845
821
846
Selects the focus the first field (in DOM order) with an error.
822
847
823
-
> ```AutoForm.selectFirstInvalidField = function selectFirstInvalidField(formId, ss) { ...```[autoform-api.js:1057](autoform-api.js#L1057)
848
+
> ```AutoForm.selectFirstInvalidField = function selectFirstInvalidField(formId, ss) { ...```[autoform-api.js:1081](autoform-api.js#L1081)
824
849
825
850
826
851
-
@@ -863,6 +888,6 @@ Is the form valid?
863
888
If creating a form type, you will often want to call this from the `validateForm` function. It provides the generic form validation logic that does not typically change between form types.
0 commit comments