1 Reply Latest reply on Nov 21, 2003 4:50 AM by 55663

    10g: Initialize State object?

      I like the idea of using the State object on the Page to manage State. I've coded the EventHandler to read the parameters and store them on the state, and I see how to read them back from the state when re-rendering the page. My object model also knows what the default selections should be when the user first opens the page, but I don't know how to get these into the State before the user makes their first set of selections and submits those to the EventHandler.

      This seems to be related to the suggestion in the documentation that one "should always gracefully handle the absence of a State object." I'd rather not have to code the equivalent of "selectedValue = (uix:pageState == null ? getDefault : uix:pageState.selectedValue)" throughout the forms. What would be the most elegant way to put "if uix:pageState == null then pageState = getDefaultState" in the page? I was thinking about just creating a defaultState property on my dataSource and using that.

      Am I barking up the wrong tree? Are there recommended patterns to "gracefully handle the absence of a State object"?