PreserveState ...

View: New views
7 Messages — Rating Filter:   Alert me  

PreserveState ...

by critter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

modelglue

I have a page that lists (in a table) a few records. Directly under
that is a form for editing and adding records. Clicking a name in the
table reloads the page passing in an 'availableid' The form is
populated with the data from that record.

Clicking update fires off an event such as this:

<event-handler name="admin.updateavailable">
        <broadcasts>
                <message name="modelGlue.GenericCommit">
                        <argument name="Object" value="Available" />
                        <argument name="criteria" value="AvailableID" />
                </message>
        </broadcasts>
        <results>
                <result do="admin.available" redirect="true" preserveState="false" />
        </results>
        <views />
</event-handler>

According the the docs, setting preserveState to 'false' and redirect
to 'true' should clear all state variables, but the page keeps loading
up just as if I had clicked on a record for editing. Shouldn't the
page load up as it were being hit with no variables passed in?

The initial page event looks like:
<event-handler name="admin.available">
<broadcasts>
        <message name="modelGlue.GenericRead">
                <argument name="Object" value="Available" />
                <argument name="criteria" value="AvailableID" />
        </message>
        <message name="modelGlue.GenericList">
                <argument name="Object" value="Available" />
                <argument name="queryName" value="qAvailable" />
        </message>
        <message name="modelglue.GenericList">
                <argument name="Object" value="Animals" />
                <argument name="queryName" value="qAnimals" />
        </message>
</broadcasts>
<results>
        <result do="view.template" />
</results>
<views>
        <include name="body" template="dspAdmin_Available.cfm" />
</views>
</event-handler>

 am I missing something?

 Critter

--^----------------------------------------------------------------
This email was sent to: lists@...

EASY UNSUBSCRIBE click here: http://topica.com/u/?b1drHn.b8CODV.bGlzdHNA
Or send an email to: modelglue-unsubscribe@...

For Topica's complete suite of email marketing solutions visit:
http://www.topica.com/?p=TEXFOOTER
--^----------------------------------------------------------------



Re: PreserveState ...

by Doug Sims :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Critter,
 are you sure you commit is happening successfully?
 iv'e always used the named results provided by the generic commit, I think you may need to use those
I *think* that if the validation of the record fails, MGU keeps the info in the viewstate, expecting you to return the user to the form page. .....not near any MG code right now, but look in your scaffold.xml file for an example of using the named results, then you can redirect upon successful commit

Doug S.

On 7/30/07, Critter <crit@...> wrote:
modelglue

I have a page that lists (in a table) a few records. Directly under
that is a form for editing and adding records. Clicking a name in the
table reloads the page passing in an 'availableid' The form is
populated with the data from that record.

Clicking update fires off an event such as this:

<event-handler name="admin.updateavailable">
        <broadcasts>
                <message name="modelGlue.GenericCommit">
                        <argument name="Object" value="Available" />
                        <argument name="criteria" value="AvailableID" />
                </message>
        </broadcasts>
        <results>
                <result do=" admin.available" redirect="true" preserveState="false" />
        </results>
        <views />
</event-handler>

According the the docs, setting preserveState to 'false' and redirect
to 'true' should clear all state variables, but the page keeps loading
up just as if I had clicked on a record for editing. Shouldn't the
page load up as it were being hit with no variables passed in?

The initial page event looks like:
<event-handler name="admin.available">
<broadcasts>
        <message name="modelGlue.GenericRead">
                <argument name="Object" value="Available" />
                <argument name="criteria" value="AvailableID" />
        </message>
        <message name="modelGlue.GenericList">
                <argument name="Object" value="Available" />
                <argument name="queryName" value="qAvailable" />
        </message>
        <message name="modelglue.GenericList">
                <argument name="Object" value="Animals" />
                <argument name="queryName" value="qAnimals" />
        </message>
</broadcasts>
<results>
        <result do="view.template" />
</results>
<views>
        <include name="body" template="dspAdmin_Available.cfm" />
</views>
</event-handler>

am I missing something?

Critter

Parent Message unknown RE: PreserveState ...

by Richard Davies-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

PreserveState only appears to work when the result element includes a
"name" attribute. I don't know if this is a bug or just a case of
incorrect documentation. For more info see
http://trac.model-glue.com/model-glue/ticket/298

P.S. You should probably use the new mailing list from now on as I doubt
many people are still using topica... :-)
http://groups.google.com/group/model-glue



Critter wrote:

>
> modelglue
>
> I have a page that lists (in a table) a few records. Directly under
> that is a form for editing and adding records. Clicking a name in the
> table reloads the page passing in an 'availableid' The form is
> populated with the data from that record.
>
> Clicking update fires off an event such as this:
>
> <event-handler name="admin.updateavailable">
>         <broadcasts>
>                 <message name="modelGlue.GenericCommit">
>                         <argument name="Object" value="Available" />
>                         <argument name="criteria" value="AvailableID" />
>                 </message>
>         </broadcasts>
>         <results>
>                 <result do="admin.available" redirect="true" preserveState="false" />
>         </results>
>         <views />
> </event-handler>
>
> According the the docs, setting preserveState to 'false' and redirect
> to 'true' should clear all state variables, but the page keeps loading
> up just as if I had clicked on a record for editing. Shouldn't the
> page load up as it were being hit with no variables passed in?
>
> The initial page event looks like:
> <event-handler name="admin.available">
> <broadcasts>
>         <message name="modelGlue.GenericRead">
>                 <argument name="Object" value="Available" />
>                 <argument name="criteria" value="AvailableID" />
>         </message>
>         <message name="modelGlue.GenericList">
>                 <argument name="Object" value="Available" />
>                 <argument name="queryName" value="qAvailable" />
>         </message>
>         <message name="modelglue.GenericList">
>                 <argument name="Object" value="Animals" />
>                 <argument name="queryName" value="qAnimals" />
>         </message>
> </broadcasts>
> <results>
>         <result do="view.template" />
> </results>
> <views>
>         <include name="body" template="dspAdmin_Available.cfm" />
> </views>
> </event-handler>
>
>  am I missing something?
>
>  Critter
>

--^----------------------------------------------------------------
This email was sent to: lists@...

EASY UNSUBSCRIBE click here: http://topica.com/u/?b1drHn.b8CODV.bGlzdHNA
Or send an email to: modelglue-unsubscribe@...

For Topica's complete suite of email marketing solutions visit:
http://www.topica.com/?p=TEXFOOTER
--^----------------------------------------------------------------


Re: PreserveState ...

by doug boude (rhymes with 'loud') :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Critter, since I AM sitting near some MG code, here's a snippet of an
event I have that is doing what Mr. Sims is talking about:

<event-handler name="inspector.create">
    <broadcasts>
        <message name="ModelGlue.genericCommit">
            <argument name="recordName" value="UserRecord" />
            <argument name="criteria" value="" />
            <argument name="object" value="User" />
            <argument name="validationName" value="UserValidation" />
        </message>
    </broadcasts>
    <views></views>
    <results>
        <result name="commit" do="inspector.newuser" redirect="true"
append="email" preserveState="false" />
        <result name="validationError" do="inspector.signup"
redirect="false" append="" preserveState="true" />
    </results>
</event-handler>

The result names are from Reactor. When your generic commit includes
validation, one of those two named results will be present and can be
used as redirectors appropriately.

Doug Boude


On 7/30/07, Doug Sims <doug.sims@...> wrote:

> Critter,
>  are you sure you commit is happening successfully?
>  iv'e always used the named results provided by the generic commit, I think
> you may need to use those
> I *think* that if the validation of the record fails, MGU keeps the info in
> the viewstate, expecting you to return the user to the form page. .....not
> near any MG code right now, but look in your scaffold.xml file for an
> example of using the named results, then you can redirect upon successful
> commit
>
> Doug S.
>
> On 7/30/07, Critter < crit@...> wrote:
> > modelglue
> >
> > I have a page that lists (in a table) a few records. Directly under
> > that is a form for editing and adding records. Clicking a name in the
> > table reloads the page passing in an 'availableid' The form is
> > populated with the data from that record.
> >
> > Clicking update fires off an event such as this:
> >
> > <event-handler name="admin.updateavailable">
> >         <broadcasts>
> >                 <message name="modelGlue.GenericCommit">
> >                         <argument name="Object"
> value="Available" />
> >                         <argument name="criteria"
> value="AvailableID" />
> >                 </message>
> >         </broadcasts>
> >         <results>
> >                 <result do=" admin.available" redirect="true"
> preserveState="false" />
> >         </results>
> >         <views />
> > </event-handler>
> >
> > According the the docs, setting preserveState to 'false' and redirect
> > to 'true' should clear all state variables, but the page keeps loading
> > up just as if I had clicked on a record for editing. Shouldn't the
> > page load up as it were being hit with no variables passed in?
> >
> > The initial page event looks like:
> > <event-handler name="admin.available">
> > <broadcasts>
> >         <message name="modelGlue.GenericRead">
> >                 <argument name="Object" value="Available" />
> >                 <argument name="criteria" value="AvailableID" />
> >         </message>
> >         <message name="modelGlue.GenericList">
> >                 <argument name="Object" value="Available" />
> >                 <argument name="queryName" value="qAvailable" />
> >         </message>
> >         <message name="modelglue.GenericList">
> >                 <argument name="Object" value="Animals" />
> >                 <argument name="queryName" value="qAnimals" />
> >         </message>
> > </broadcasts>
> > <results>
> >         <result do="view.template" />
> > </results>
> > <views>
> >         <include name="body"
> template="dspAdmin_Available.cfm" />
> > </views>
> > </event-handler>
> >
> > am I missing something?
> >
> > Critter
> >
>

Re[2]: PreserveState ...

by critter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[quote day="Monday, July 30, 2007" time="3:42:39 PM" who="Doug"]

DS>  are you sure you commit is happening successfully?
DS>  iv'e always used the named results provided by the generic commit, I think
DS> you may need to use those

Aye, they are definitely happening, I can see the additional records
in the database. I am headed to the docs for info on the named
results.

Crit

--^----------------------------------------------------------------
This email was sent to: lists@...

EASY UNSUBSCRIBE click here: http://topica.com/u/?b1drHn.b8CODV.bGlzdHNA
Or send an email to: modelglue-unsubscribe@...

For Topica's complete suite of email marketing solutions visit:
http://www.topica.com/?p=TEXFOOTER
--^----------------------------------------------------------------



Re[2]: PreserveState ...

by critter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[quote day="Monday, July 30, 2007" time="11:34:07 PM" who="Doug"]

DB> Critter, since I AM sitting near some MG code, here's a snippet of an
DB> event I have that is doing what Mr. Sims is talking about:

Thank you, very much! That is very helpful.

Critter

--^----------------------------------------------------------------
This email was sent to: lists@...

EASY UNSUBSCRIBE click here: http://topica.com/u/?b1drHn.b8CODV.bGlzdHNA
Or send an email to: modelglue-unsubscribe@...

For Topica's complete suite of email marketing solutions visit:
http://www.topica.com/?p=TEXFOOTER
--^----------------------------------------------------------------



Re[2]: PreserveState ...

by critter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[quote day="Monday, July 30, 2007" time="11:34:07 PM" who="Doug"]

DB> The result names are from Reactor. When your generic commit includes
DB> validation, one of those two named results will be present and can be
DB> used as redirectors appropriately.

Doug -

This worked great for when I do a generic commit, thanks. I do have a
question though, and I have not been able to locate it in the mg docs
or the reactor docs. Are there named results for a generic delete as
well? I have tried 'commit' and 'delete', but it does not process
properly, even though the record /is/ deleted from the database..

Crit

--^----------------------------------------------------------------
This email was sent to: lists@...

EASY UNSUBSCRIBE click here: http://topica.com/u/?b1drHn.b8CODV.bGlzdHNA
Or send an email to: modelglue-unsubscribe@...

For Topica's complete suite of email marketing solutions visit:
http://www.topica.com/?p=TEXFOOTER
--^----------------------------------------------------------------


LightInTheBox - Buy quality products at wholesale price