Caution: I work with a backend that I do not have full control over, so I struggle with a few considerations within the Backbone that might be better addressed elsewhere ... Unfortunately, I have no choice but to process them here!
So, my problem is that I really would like to confirm user input from the form (when I set the values ββwith it on the Backbone model), but the models that I get from the API are on newly created objects (via messages that ONLY accept the name and ONLY return the name and identifier of the object) will not conduct verification checks.
As an example, when a new object is created in the database, two key fields are filled as empty lines (and therefore, when the Backbone gets into the API and populates the models, it fills these keys with empty lines). When the user saves these objects back after editing, I would like to force them to enter values ββfor these two keys, which is very simple, given that the basic construction is built into the verification method.
The problem, of course, is that validation works for both fetch-> set (undesirable behavior) and set-> save (desired behavior) - and therefore the newly created models will not load at all ... The trunk collects them, checking not executed, and errors are triggered.
So my question is: is there a "Backbone-y" method only for checking models on set-> save, and not on fetch-> set? Can I use a specific trigger to get around this?
We will be very grateful for any ideas.
ltd
source share