Skip to Content

What is the best technique for resetting a view?

I was wondering what is the best technique for resetting the initial state of a view?

I am creating a form and want to provide a reset button for the user. I could write an initialize() method that my action handler calls, but I am wondering if the framework already provides this functionality in a more elegant way.

If I write an initialize method, then I have to manually populate my fields with my context mappings in my initialize() code to mimic what happens automatically by the framework the first time the view is called. This seems prone to error since this is duplicating the mapping logic.

Michael

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Dec 08, 2004 at 12:30 AM

    Hi,

    Even though it boils down to the same logic, for consistency sake it is good to have the initialization logic coded in the inbound plug method and then to call the outbound plug on reset.This make more sense when you have multiple navigation possible to the same view through multiple inbound plugs.

    Else, have an initialization method.

    PS: check whether the reset() method of IWDContext make sense. This is helpful when you have remove dynamically added nodes and attributes.

    Thanks and Regards,

    Sam Mathew

    Add comment
    10|10000 characters needed characters exceeded