On Fri, Mar 12, 2010 at 4:45 PM, Mike Wright <mike.wri...@mailinator.com>wrote:
> David Mintz wrote: > >> On Fri, Mar 12, 2010 at 1:34 PM, scs <sasc...@gmail.com> wrote: >> >> Hi, >>> I would validate each step's data and save it in session. >>> However, if any previous tab is clicked and there was an attempt to >>> change any validated input, >>> then I would validate that input again. >>> >>> In other words, >>> click 2nd tab->validate 1st tab data and save in session. >>> click 3rd tab->validate 2nd tab data and save in session >>> click submit button -> validate 3rd tab data and insert the >>> session-saved+3rd tab's validated data in db (or any operation else) >>> if any previous/validated tab clicked and information is changed on >>> that tab (before the submit is clicked), re-validate that data again. >>> I do not think there is a need to re-submit all tabs' data again once >>> the submit button is clicked. >>> >>> >> So it doesn't make it into the session unless it's valid. This sounds like >> a >> good approach. >> >> Question: how do we detect whether they have changed data in a >> previously-validated tab? Compare POSTed data to what's in the session, >> obviously. But how expensive is that compared to validating again >> unconditionally? Especially considering that if it's changed we will >> definitely validate again anyway. >> > > Doesn't all of this become irrelevant if the current subForm is validated > and stored on any submission? After that your model/flow can decide which > subForm should be presented next. That makes possible previous/next and > buttons to arbitrarily select the order of the forms (after all, the user > should be able to determine their own workflow, no?). > > .02 US (not worth much before, a lot less now) > Maybe I'm not getting your point. I don't plan to have subforms correspond to tabs one-for-one, because there are multiple models, each with a corresponding subform. I just want to split up groups of fields into tabs for the sake of presentation; there's a single submit button for all. When they move from tab to tab they aren't going to be submitting, but it seems a fine opportunity to processAjax() and validate the current section of the form before it gets hidden from view. -- Support real health care reform: http://phimg.org/ -- David Mintz http://davidmintz.org/