4 Replies Latest reply on Feb 25, 2009 3:02 PM by John Hall

    Clearing Form Fields

    John Hall Level 4
      I have a form that binds to objects just fine. There are many custom objects and each time I'm editing an object, I bind all the fields in the form to currentObject.name, currentObject.ID, etc. I keep a history so if they cancel editing, I revert to the previously displayed object in the form. My question relates to the first object. When I enable the form for the first time, currentObject is null. If I start typing in the fields and decide to cancel the edit, I'd like to clear all the fields before disabling the form. However, if there is no previous object to replace the information in the fields I've typed in, the new characters stay there even though the currentObject is still null and even if I reset the currentObject to null. Which event should I be dispatching to tell the form "hey, wake up and recheck your bindings because everything in the form should be null now because I'm cancelling this edit session." I've tried Event.change and even tried a custom event but I haven't hit on the right combo yet that clears the fields. I can clear them manually pretty easily but that doesn't feel right. I should be able to use the event model to rebind to a null currentObject.

      Thanks.