I use knockout databinds on webforms. Currently I have a reset function that is used before re-loading original data to clear the form. I have over 60 fields that I need to clear and doing each one individual is a pain. Is there a way to clear all knockout bindings at once? Currently what I use is below:
self.parentObject.somefield('');
self.parentObjectAddress.street1('');
etc
etc
-- Update 1--
To add clarification all my fields are part of a parentObject. Example
self.parentObject.fieldName
What I am looking to do is clear all children of the parentObject.
I would consider a different approach. Rather than "resetting" the object itself, why not create a new object, and throw the old one away? You should already have code to create the object. If you have a
data-bind="with: someObject"
at the top level (maybe the<form>
tag?) then replace someObject (assuming it's observable) with a new, "clean" instance of the object.