- Massive docs overhaul (Issues #14, #48, #62).
- Destroyed element templates are now removed from the validation context (Issue #87).
- Add missing namespace export to package.js.
- Address issue #76.
- A
field
helper is now available informContext
as well as in the custom form block helpers. This reactively gets the value of any given form field (even nested ones).- Example:
{{#with formContext}}{{field 'name.first'}}{{/with}}
.
- Example:
- A
- Add missing
onDestroy
hook for elements (Issue #73). - Fix SimpleSchema support (Issues #69, #84).
- Fix global
context
helper and rename it toformContext
(Issue #64).- Add several missing properties to the helper object.
- This is the only breaking change to the public API in this release.
- Convert codebase to JavaScript as part of a transition to ES2015 classes.
- Refactor code, package structure, and improve comments.
- Update SimpleSchema dependency to latest version.
- Adjust internal
isObject
function to fail for Date objects and regular expressions.
- Fix regression (Issue #38) where
_id
fails to show up in the data context of theaction
function. - Address issue #55.
- Calling
reset(true)
now resetschanged
andvalid
states on individual elements.
- Calling
- Major update that addresses issues #28, #55, and #56.
- Nested schemas are now supported.
- An
onDataChange
hook can now be passed into a form block via a template helper.- This has access to several useful methods that allow fine-grained control over what
happens when reactive initial data is changed.
this.reset()
calls the same method ascallbacks.reset()
in the action function.this.refresh()
will cause every Element to refresh itself with the new initial data. If the user made changes to an Element, that Element's value won't be updated in the DOM, but it will have a new original value.this.changed()
causes the form to take on thechanged
state (as if a user had made changes to the form).
- This has access to several useful methods that allow fine-grained control over what
happens when reactive initial data is changed.
- The
changed
argument to the action function now only contains fields that have actually changed from the initial data (compared to before, where any user-modified fields would exist). - Added new template helpers for Elements, which should make dealing with initial data easier.
{{originalValue}}
shows the original value of this field where initial data is present.{{uniqueValue}}
is a boolean for whether the current value of a field is unique from the original value.
- Address issues #51 and #54.
- Refactor to fix errors.
- Fix
context
helper by adding extra checks. - Fix resetting functionality.
- By default,
callbacks.reset()
now clears all states exceptsuccess
orfailed
and related messages. This provides a nice default experience for users that doesn't jar them away from the last session without some idea of what happened (the states clear on the next form change automatically). - To clear all states and messages, perform a hard reset with
callbacks.reset(true)
.
- By default,
- Fix regression where
{{valid}}
was incorrectly set.
- Fix incorrect var name in previous update.
- Allow element validation to be immediately cancelled and/or called manually in async fashion with
return this.stop
andthis.validate(val)
. - Improve support for parent/child elements.
- Elements now check their parent template context (up to 5 levels) to determine where the
form block context is, rather than assuming it's one level up. When the parent is an element,
the sub-element will take the parent element's
field
as its own. - Elements now support
standalone=true
explicit standalone mode in the template invocation. createElement
now supportspassThroughData
option--elements with this option settrue
will accept remote data changes without waiting for a user's action. This is useful for elements receiving data from a join (for example, a checklist of related documents).
- Elements now check their parent template context (up to 5 levels) to determine where the
form block context is, rather than assuming it's one level up. When the parent is an element,
the sub-element will take the parent element's
- Switch from Blaze.ReactiveVar to non-namespaced ReactiveVar and add dependency.
- Address issues #50, #51, #52, and #53.
- Allow for custom success and failed messages:
- Messages can be easily added in callbacks, like
callbacks.success('...message...')
. failedMessage
andsuccessMessage
template helpers now exist for form blocks.
- Messages can be easily added in callbacks, like
- Add official support for resetting a form.
- Elements can now specify a
reset
method increateElement
config. - A
callbacks.reset()
clears all element data using thereset
methods, and clears form data context in a form block.
- Elements can now specify a
- Add support for an array of events in
validationEvent
. {{valid}}
reactivity should now registerchanged
when the element's field is invalidated in SimpleSchema from the outside.
- Allow for custom success and failed messages:
- Revisit issue #27.
- Rewrite validation so that optional fields are only checked if they exist.
- Address issue #47.
- The reactive data context and
valueDeps
for an Element now exist at the Form Block level, which allows all element templates with the same field in that form to share the same value- dependent states. Hopefully this also addresses lingering concerns from #31. - Validation is now triggered whenever data is changed, meaning validation happens after data is set, rather than before. This doesn't mean anything to the end-user, because submission won't run unless the data is valid (provided a schema exists). It would be preferred to ensure that only valid data reaches the form-level data context, however.
- The reactive data context and
- Refactor.
- Address issue #46.
- Clearly differentiate between changes enacted by the user (from event handlers) and changes from other sources.
- Only trigger
changed
state on user-enacted changes to the form.
- Fix
setState
function.
- Remove leftover console log.
- Major update with many improvements.
- Addresses issues #40, #41, #42, #43, #44, and #45. Fixes regression from issue #37.
- Add robust support for dealing with reactively changing form data.
- Remote changes to data being actively edited in a form can now be elegantly revealed to
the user in real-time, using the
{{remoteValueChange}}
and{{newRemoteValue}}
template helpers. There are also two template instance methods to hook into from event handlers. - Fix handling of initial data and how it bypasses the
changed
state. - On nested Element templates that don't actually provide data to the form, avoid running
duplicate initial validation in the
rendered
callback. ReactiveForms.namespace
now allows programmatic access to whatever internal namespace the package uses in template instances.- Update docs with a chapter on working with remote data.
- Refactor and clean up code/comments.
- Address issue #39.
- Add
unchanged
andunsubmitted
helpers.
- Add
- Fix typo in docs.
- Address issue #38.
- If initial data has an
_id
field, pass that through to the form data context. - Allows easier updates using the
action
function.
- If initial data has an
- Address issue #37.
- Throttle
validationEvent
handler.
- Throttle
- Revisit issue #31.
- Improve nested Element templates example in docs.
- Update to support simple-schema
v1.3.0
.
- Address issue #31.
- Update docs to include a section on working with nested Element templates.
- Address issues #27 and #32.
- Provide more helpful error messages in Form Block field validation.
- Address issue #34.
- Form Blocks now accept falsey initial data.
- The same form block can now be more easily used for inserts and updates.
- Fix typo in 1.10.1.
- Address issue #33.
validationEvent
is now optional, and the event handler will only be added to an element template if it exists.- This allows easier creation of nested elements and wrapped elements.
- Address issue #8.
- Allow access to all schema properties in Element templates.
- Reorganize files.
- Add missing
lib/init.coffee
file topackage.js
. - Fixes problem with
defaultFormBlock
from issue #15.
- Address issues #20 and #21.
- Support custom
created
rendered
anddestroyed
callbacks on both Form Blocks and Elements. - Namespace component data.
- Support custom
- Automatically register
defaultFormBlock
.
- Transitional release before
v2.0.0
. - Address issues #13, #15, #16, #17 and #18.
- The
changed
argument in the action function is nowundefined
if no initial data was provided. - Consolidate helpers passed into
UI.contentBlock
into onecontext
argument. Log deprecation warning when helpers are passed in individually. - The container div in the
basicInput
example has been removed. - The endpoint to create a form block is now called
createFormBlock
. Use ofcreateForm
will log a deprecation warning. - Minor update to
basicInput
andbasicForm
code. - Change
basicForm
template name tobasicFormBlock
(but keepbasicForm
for compatibility). - Add
defaultFormBlock
block helper that supports using form block helpers directly. - Add global
context
helper to allow direct access to form-level helpers in a form block'sUI.contentBlock
. This keeps reactivity normal (#17) and enablesdefaultFormBlock
-style usage (#15).
- The
- Docs update:
- Capitalize component names throughout; more clearly distinguish between these components and HTML elements of the same name.
- Sync up examples.
- Move thanks to @steph643 for issue contributions out of here and into the docs.
- Address issues #12 and #13.
- The
changed
argument in the action function now contains any fields that have changed, not just fields that were originally present in the initial data. - Support the optional
options
object to Simple Schema'sclean
function invalidationValue
.
- The
- Address issues #9 and #11.
- Initial data now supports objects with prototype methods.
- If initial data was provided, an object containing only the changed fields is passed into the action function.
- Refactor to allow form fields to have falsey values.
- Address issues #5, #6, and #7.
- Update docs:
- Describe the
field
property on elements and how it connects them to form blocks. - Correct description of
invalid
helper (form blocks).
- Describe the
- Fix
package.js
to supportinstructions
field on client and server-side SimpleSchemas.
- Update docs:
- Elements inside a form block now validate against the form-level data context.
- Fixes a bug with custom validation in SimpleSchema.
- All form-level helpers inside elements (
submitted
,success
,loading
) now default tofalse
when the element is being used standalone. - Individual helpers can now be overridden on elements if they're specified on the element template's invocation.
- Add
isChild
helper to elements. - Remove
failed
helper (added in v1.4.0) from element scope.- Submission failure should be handled outside this scope.
- As
failed
andsuccess
are mutually exclusive states, you can handle submission failure using{{#if submitted}} {{#unless success}}
anyway.
basicInput
example now supports passed-in (default) data with thevalue
helper.
- Revisit change from v1.5.0 where setting the
changed
state totrue
changessubmitted
andsuccess
states tofalse
.- Only change
submitted
state to false ifsuccess
state is also true at the timechanged
is set to true. This better serves the original use case, and hopefully avoids unexpected functionality.
- Only change
- Internal comparisons are now made with Underscore's
_.isEqual
method, for full type support.
- Improve default internal logic.
- Setting
changed
state on a form block instance totrue
by necessity changessuccess
andsubmitted
states tofalse
. - Fix
setValidatedValue
method in form blocks, so that now it checks if the field has been added to the form's data context before it checks if the field was in passed-in data. This allows the method to runchanged
on field updates even if they contain the same value that the passed-in data had. The focus is now on unique from the last value.
- Setting
- Elements now have access to
failed
andsuccess
helpers. - This seemed important, particularly as
success
is useful for element cleanup after submission.
- Add
submitted
helper to form blocks.
- Add
changed
helpers on both form blocks and elements.- Starts
false
, sets totrue
whenvalidationEvent
is triggered and data passes validation. - Initial data is validated on render, but
changed
isn't called during that time.
- Starts
- Fix typo. Action function had
callbacks.falied
instead ofcallbacks.failed
.
- Refactor.
- Use jQuery's
.val()
as the default way to get an element's value, instead of.value
. - Add
validationValue
option to ReactiveForms.createElement. - Add ability to pass in initial data for form elements, at the form or element level.
- Create form-level data context.
- Store last validated value for all elements in the form block.
- Context is unique to every form block template instance.
- Bind action function to the form-level data context when it's called.
- Integrated with SimpleSchema.
- Tested in a local project.
ReactiveForms.createForm
andReactiveForms.createElement
working.- Form states are mutually exclusive, making it easy to display messages in one place.
- Action function grabs all
.reactive-element
elements in the form. - Both types of templates can be used together or standalone.