Changelog History
Page 1
-
v0.13.2 Changes
October 26, 2015๐ฅ Breaking Changes
- Now depends on React 0.14.
๐ Changes
- โ
Select
andSelectMultiple
no longer renderselected
attributes on their options, which was causing a warning message. React 0.14 now handles creating these in server-generated markup via parent context. - Documented that when using a custom rendering component with
RenderForm
, the Form instance is now available via aform
context variable due to React 0.14 parent context.
-
v0.13.1
October 26, 2015 -
v0.13.0
October 23, 2015 -
v0.12.1 Changes
March 12, 2015๐ Bug Fixes
- ๐ Changed method of detecting if we're running in the browser to avoid false
positives when browserify/webpack insert
process
shims into browser bundles.
A false positive can result in an
Error
being thrown when validating a client-sideFormSet
(#75) - ๐ Changed method of detecting if we're running in the browser to avoid false
positives when browserify/webpack insert
-
v0.12.0 Changes
March 11, 2015๐ See the Upgrade Guide for instructions on upgrading to this release from the previous version.
๐ฅ Breaking Changes
- Now depends on React 0.13.
๐ Changes
- ๐ฏ
RenderForm
no longer depends on havingReact.addons.cloneWithProps()
๐ฏ available for custom rendering, due to newReact.cloneElement()
top-level
API.
Removals
- โ Removed deprecated
formsetFactory()
.
-
v0.11.0 Changes
March 11, 2015๐ See the Upgrade Guide for instructions on upgrading to this release from the previous version.
๐ฅ Breaking Changes
- ๐ Renamed
BaseForm
toForm
, changing the top-level API - this has the same
behaviour as the currently-exportedforms.Form
. - ๐ Renamed
BaseFormSet
toFormSet
, changing the top-level API. - Replaced
util.formData()
with the
๐ฆ get-form-data module -
formData()
has been renamed togetFormData()
. - ๐ Newforms is now published to npm as flattened, top-level modules, so
individual modules (such asForm
,FormSet
, fields, widgets, React
components,ValidationError
...) can be required with
require('newforms/<modulename>')
- this makes it possible to reduce the size
๐ป of your own browser bundles by requiring only what you use.
๐ New Features
- โ Added new core
Field
argument:field.widgetAttrs
- this allows you to
provide additional widget attributes without having to redefine the entire
โ widget (docs) (#62) - โ Added
Form.prototype.prefixFormat
('{prefix}-{name}'
) and
๐FormSet.prototype.prefixFormat
('{prefix}-{index}'
) to define how prefixes
are generated. These can be overridden when extending these components to
๐ customise now field names are generated when prefixes are used
โ (example) (#70)
๐ Changes
- โ Added former
formsetFactory()
options toFormSet
proper (API docs)FormSet
can now be constructed directly, setting all formset-specific options for the instance instead of having to extend it,FormSet.extend()
can now be used directly to preconfigure aFormSet
constructor with theForm
constructor to be used and any other formset
options.
FormSet
options can now be overridden when constructing aFormSet
.- An error will now be thrown if a
FormSet
is constructed without aForm
constructor. - ๐ป
FileField
cleaned data is now a nativeFile
object, when the browser
๐ supports it (docs) (#61)- Added a
multiple
argument forFileField
- cleaned data will be a list of
File
objects. - Filename length and empty file validation can now be performed on the client
when aFile
object is available.
- Added a
- 0๏ธโฃ Widget attribute defaults are now always provided by numeric fields when not
already set, regardless of the type of widget being used, to allow custom
widgets which don't extendNumberInput
to make use of them
(#59)
๐ Bug Fixes
DecimalField
now handles all-zero inputs correctly - it was cleaning them
to an empty string (#57)- โ
Select
widgets no longer generate React dev-mode warnings about unique key
props (#68)
๐ Deprecations
- ๐
formsetFactory()
is deprecated in favour of usingFormSet.extend()
to
0๏ธโฃ create a FormSet with defaults for the same options and any custom methods
required.
Removals
- โ Removed deprecated
Form
rendering methods (render()
,asTable()
,asDiv()
andasUl()
). - โ Removed deprecated
FormSet
rendering methods (render()
,asTable()
and
asDiv()
).
- ๐ Renamed
-
v0.10.1 Changes
January 08, 2015- ๐ Version bump to fix tags -> keywords in package.json.
-
v0.10.0 Changes
January 04, 20150๏ธโฃ Major features in 0.10 are support for asynchronous validation and new React components for default rendering.
๐ Asynchronous validation (docs)
clean()
andclean<FieldName>()
methods can now use asynchronous validation - defining them with a single parameter will let newforms know they will be asynchronous: There is a bunch of new API on Forms, FormSets and BoundFieldscleanUsername: function(cb) {// ...}
form.validate()
now takes an additional callback argument which is required if a Form or FormSet has async validation.0๏ธโฃ Default rendering now includes a
<progress>
element on fields, forms and formsets which have pending asynchronous validation.๐ React components (docs)
๐ Newforms now provides
RenderForm
andRenderFormSet
React components for default Form and FormSet rendering:\<RenderForm form={MyForm} ref="myForm"/\>
๐ Default rendering methods on Forms and FormSets (
.render()
,.asTable()
,.asDiv()
,.asUl()
) are now deprecated and will be removed in the next release.
๐ CHANGES for 0.10.0
๐ฅ Breaking Changes
- โ Removed
formset.asUl()
- it never appeared properly due to the management
Form. formset.cleanedData()
to no longer includescleanedData
from incomplete
extra forms.- You can no longer change
cleanedData
by returning a value from a Form's
clean<Name>()
orclean()
method.
๐ New Features
- โ Added
RenderForm
,FormRow
andRenderFormSet
components for default
rendering.- The browser build requires the react-with-addons build of React in order to
๐ useRenderForm
's custom rendering support.
- The browser build requires the react-with-addons build of React in order to
- Custom
clean()
andclean<Field>()
validation methods can now be
specified with the signature(callback)
if they need to perform
asynchronous validation.- The callback is an errback with the signature
(err, validationError)
. clean()
will not be called until other fields - or just fields it
๐ง depends on, if configured - have been cleaned, synchronously or
asynchronously.
- The callback is an errback with the signature
form.validate()
andformset.validate()
now take a callback argument,
which is required if the Form or Formset has custom async validation
๐ง configured -validate()
can be used as normal for Form and Formsets
without async validation.- The callback is an errback with the signature
(err, isValid, cleanedData)
.
- The callback is an errback with the signature
- ๐ New API related to async validation:
form.isAsync()
/formset.isAsync()
-true
if a form/formset has custom
async validation.form.isPending()
/formset.isPending()
-true
if a form/formset has
pending async validation.form.nonFieldPending()
/formset.nonFieldPending()
-true
if async
validation of a form/formset'sclean(cb)
method is pending.boundField.isPending()
-true
if a field has a pending async validation.isFormAsync(Form)
-true
if a Form constructor's prototype has async
validation methods.
- 0๏ธโฃ
<progress>
indicators are now displayed by default rendering methods:- Beside fields with pending async validation.
- At the end of the form when cross-field validation is pending.
- โ Added more conditional CSS classes which will be used if defined in a Form:
optionalCssClass
- used for optional fieldspendingCssClass
- used for fields with pending async validation
- โ Added
boundField.helpTextTag()
to expose the mechanism for rendering raw
HTML. - โ Added
boundField.status()
to get a field's status as a string
0๏ธโฃ (pending/error/valid/default). - โ Added
fromJSON()
factory functions toErrorList
andErrorObject
constructors andfromJSON()
instance methods. These can be used to rehydrate
anErrorObject
on the receiving end whenform.errors()
is transferred as
JSON. This assumes the structure created by these objects'toJSON()
methods. - โ Added
form.setErrors()
to set anErrorObject
with errors from another
source. - An
ErrorObject
can now be passed as anerrors
option when creating a form
instance, to redisplay a form with errors from another source. This prevents
the form's own validation from running if the form has inputdata
and
isValid()
orerrors()
are called during rendering.
๐ Deprecations
- Form rendering methods (
render()
,asTable()
,asDiv()
andasUl()
) are
๐ deprecated in favour of using React components for rendering -RenderForm
0๏ธโฃ now provides default rendering. - FormSet rendering methods (
render()
,asTable()
andasDiv()
) are
๐ deprecated in favour of using React components for rendering -RenderFormSet
0๏ธโฃ now provides default rendering.
๐ Changes
- ๐ Reverted a change from 0.9. Synchronous calls to
form/formset.validate()
โก๏ธ will trigger a re-render, as it looks likeforceUpdate()
just enqueues a
future re-render. form.isComplete()
is nowfalse
if there is any pending async validation,
even if all required fields currently have cleaned data.- ๐ Changes to when event-based validation fires:
- Validation now only fires if the field's data has changed since it was last
0๏ธโฃ validated. For'auto'
validation, this prevents the defaultonBlur
0๏ธโฃ event from re-running the same validation as the defaultonChange
. - Special cases for
onBlur
: - Pending validation is triggered immediately.
- Validation is always triggered if the field is required and empty.
- Validation now only fires if the field's data has changed since it was last
- ๐ Changed
form.addError()
to no longer add duplicate error messages for the
same field. This can happen ifonChange
validation which runs repeatedly
โ adds errors to a field other than that which triggered the validation, using
addError()
. - 0๏ธโฃ The default
rows
attribute for aTextarea
changed from 10 to 3. - Error messages now make use of a
displayName
property if a Form has one.
Removals
- ๐ The deprecated
onStateChange
argument to Form and FormSet constructors has
๐ been removed - useonChange
instead.
- โ Removed
-
v0.9.1 Changes
November 25, 2014๐ Fixed in this release:
- The object given to
Form.extend()
is no longer mutated.
- The object given to
-
v0.9.0 Changes
November 11, 2014๐ (For an alternative view of new features/changes, see the Development Wiki)
๐ This release brings a bunch of sanity improvements (auto validation by default, better basic validation API) and improvements to FormSets which just about make them usable on the client (see Dinner Time! for an example).
๐ฅ Breaking Changes
- Form mixins must now be specified as a
__mixins__
property rather than
__mixin__
. - ๐ Changed
form.validate()
to no longer call back to re-render -- this
โก๏ธ was convenient for single forms, but results in multiple updates when
๐จ processing multiple forms. Re-rendering must now be triggered manually if
onSubmit validation fails. formset.cleanedData()
to no longer includescleanedData
from unmodified
extra forms.
๐ New Features
- Passing
onChange
to a Form or FormSet now impliesvalidation: 'auto'
. - โ Added
form.notEmpty()
to determine when required fields in an extra
FormSet form become truly required. - โ Added
formset.validate([form])
-- equivalent to the Form version, use to
set a formset's data from a<form>
or to force full validation of its
current input data. - โ Added
formset.removeForm(index)
to remove extra forms from a FormSet. It
will also call back to trigger a re-render when possible. - โ Added
errorlist#first()
for conveniently getting just the first validation
error message. - โ Added
formset.addError()
for adding non-form errors outside ofclean()
. - ๐ Changed
form.validate([form])
so the argument is optional - it can now be
๐ used to force full validation of a form with its current input data. - Form
clean()
functions can now specify which fields they make use of for
cross-field validation:clean: ['field1', 'field2', function() {}]
. When
โก๏ธ provided,clean()
will only be called during partial form updates (e.g.
onChange
handling) if one of the specified fields is affected.
๐ Deprecations
- The
onStateChange
argument to Form and FormSet constructors -- use
๐onChange
instead.onStateChange
will be removed in the next version.
๐ Changes
- โก๏ธ
onChange
handlers are now always attached to widgets to update input data,
regardless of controlled/validation config. formset.addAnother()
will now call back to trigger a re-render if
possible.- ๐ Changed partial form validation to remove any validation errors if an extra
FormSet form is unchanged from its initial values.
- Form mixins must now be specified as a