[ALOY-1226] To Do sample app - validate() fails to prevent invalid (empty) items from being added
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-09-11T20:44:51.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.7.1 |
Components | Samples & Templates |
Labels | n/a |
Reporter | Tim Statler |
Assignee | Feon Sua Xin Miao |
Created | 2015-01-13T19:31:28.000+0000 |
Updated | 2015-09-11T20:44:55.000+0000 |
Description
The model definition in the test/apps/models/todo app includes a validation check. If a model doesn't pass this check, it should not be added to the database. However, empty items are being added.
Per the [Backbone docs](http://backbonejs.org/#Model-validate), you override the validate function with your own code. If a model fails validation, you return any string and save() will be prevented.
PR: https://github.com/appcelerator/alloy/pull/710
PR merged.
Verified using: Windows 8.1 Appc CLI Core: 5.0.0-50 (Alloy 1.7.X) Appc CLI NPM: 4.2.0-1 Titanium SDK : 5.0.0.v20150911123911 Galaxy Note 3 (4.4.2) When using the todo sample in models/todo when adding an empty item it is not added to the list Closing ticket