-
Notifications
You must be signed in to change notification settings - Fork 48
Development Archive
Jonny Buchanan edited this page Mar 6, 2015
·
6 revisions
- ☑ Remove
onStateChange
- ☑ Fix for using
this.addError()
inclean()
- now checks for duplicates. - How can we avoid clearing async validation messages unnecessarily?
- ☑ Only validate if data has changed since the last validation was triggered.
- Special cases for
onBlur
:- ☑ Trigger any pending validation.
- ☑ Always validate if the field is required and empty.
- ☑ New conditional CSS class Form properties:
optionalCssClass
&pendingCssClass
- Async validation
- API (allow fields to have custom but separate sync and async validation):
- ☑
form.clean<Field>: function([cb]) { }
- use existing method, callback optional - ☑
form.clean: function(cb) { }
- use existing method, callback optional - ☑
formset.clean: function(cb) { }
- use existing method, callback optional - Async versions of any top-level API which triggers the equivalent of full-form/
onSubmit
validation.- ☑
form.validate(cb)
- ☑
- ☑
- ☑ Async
onChange
(hooked up automatically by newforms)- Custom field validation functions now get a callback if they have an arity of 1
- Async
onSubmit
(user's responsibility to hook up)- ☑ Callback once all async validation completes
- ☑ New form state for pending validations
- ☑ These need to be cancellable for cases where multiple async validations are running simultaneously and some of their results need to be ignored
- Can be used to display "working" status to the user and to delay final callback for full-form validation until al async validations are complete.
- ☑ Add a method to BoundField to retrieve this status per-field
- ☑ Use this to implement display of pending async field validation in default rendering methods.
- ☑ Add
pendingCssClass
and generate it from BoundField
- ☑ Add a method to BaseForm to retrieve pending status for all fields
- ☑ A Form should never be
isComplete()
if still pending async validation
- ☑ A Form should never be
- ☑ Add a method to BaseForm to retrieve this status for cross-field validation
- ☑ Implement display of pending cross-field/whole-form validation in default rendering methods.
- ☑ Add a method to BoundField to retrieve this status per-field
- API (allow fields to have custom but separate sync and async validation):
- ☑ Create React components for default rendering
- ☑ Deprecate
asDiv
/asTable
/asUl
- ☑ Deprecate
- Changes to onChange & active validation
- ☑ Rename
onStateChange
toonChange
- ☑ Detect
onStateChange
, reassign toonChange
and warn of deprecation in 0.9 dev version
- ☑ Detect
- ☑ Passing
onChange
now implies `validation: 'auto'- ☑ Check for both being passed and warn that it's not necessary in 0.9 dev version
- ☑ Always hook up an
onChange
handler to widgets to keepform.data
up to date with user input, even if it's not being validated
- ☑ Rename
- ☑ Use
form.validate()
as a means of forcing a full clean with the form's current data (always populated by onChange) - FormSet & FormSet-related changes
- ☑ Add
formset.validate([form])
- ☑ Add
formset.addError(error)
for adding cross-form errors externally - ☑ Add
formset.deleteForm(index)
- ☑ Add
form.notEmpty()
- ☑ Cache the result of
hasChanged()
each time it's executed - Indicates that
emptyPermitted
no longer applies - use for highlighting required fields in extra forms in FormSets once the user has made a change.
- ☑ Cache the result of
- ☑ Make
addAnother()
anddeleteForm()
call back to re-render whenonChange()
is available
- ☑ Add
- ☑ Allow cross-form validation method to specify which fields it uses (to avoid calling it when possible)
-
API:
clean: ['field1', 'field2', function() { ... }]
-
☑ Detect this in
DeclarativeFieldsMeta
and transform to equivalent of:var clean = function() { ... } clean.fields = {'field1': true, 'field2': true}
-
- Use React 0.12
- ☑ Add a
locales
module for adding/getting locales and setting a default. - ☑ Change the
formats
module to uselocales
, adding agetFormat()
function to get input/output formats by locale.
- ☑ Add support for partial cleaning/validation
- ☑ Add a
controlled
(default:false
) option to Forms to enable use of controlled input components- ☑ Add a
prefixed
(default:false
) option tosetData()
andupdateData()
, as the user shouldn't be forced to pass prefixed field names in order to programatically update controlled fields.
- ☑ Add a
- ☑ Add interactive onChange validation - whole form or per-field
- ☑ Allow registration of multiple event handlers
- ☑
'auto'
validation adds delayedonChange
an instantonBlur
validation to text fields, so the user also gets feedback when leaving a required field if they didn't change anything.
- ☑ Add API for updating
form.data
without triggering validation, for controlled components- ☑
validate
(default:true
) andclearErrors
(default:true
) options toupdateData()
- ☑
validate
(default:true
) option tosetData()
- ☑
- ☑ Get FormSets working with 0.6 features
- ☑ Pass kwargs through to
form.setData()
- ☑
validate
(default:true
) option tosetData()
- ☑ Pass kwargs through to
- ☑ Rename
isBound
toisInitialRender
- more explicit about what it's actually used for.
- ☑ Migrate from DOMBuilder to React
- ☑ Generate
React.DOM
components - ☑ Manual validation, no changes needed to cleaning/validation process
- ☑ Build data object from the DOM using
formData()
- ☑ Make FormSet API more suitable for the client side