Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1226] To Do sample app - validate() fails to prevent invalid (empty) items from being added

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2015-09-11T20:44:51.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.7.1
ComponentsSamples & Templates
Labelsn/a
ReporterTim Statler
AssigneeFeon Sua Xin Miao
Created2015-01-13T19:31:28.000+0000
Updated2015-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.

Comments

  1. Feon Sua Xin Miao 2015-07-13

    PR: https://github.com/appcelerator/alloy/pull/710
  2. Praveen Innamuri 2015-07-31

    PR merged.
  3. Ewan Harris 2015-09-11

    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

JSON Source