We really should remove all the RequestCycle methods from components if i
read these kind of mails....

form.setResponsePage() doesn't mean that in the onSubmit that page is set as
a response!

That is something you should do yourself yes in the onSubmit()
you dont have to do then form.xxxx
just setResponsePage() is enough

those methods are just all helper methods that are nothing more then relays
to the RequestCycle

You dont set state on the Object itself (like here form)

johan


On Tue, Mar 25, 2008 at 1:08 PM, Eric Rotick <[EMAIL PROTECTED]> wrote:

> I have simplified the class and it behaves the same.
>
> public class SingleItemForm extends Panel {
>
>    public SingleItemForm(
>        String id,
>        final boolean readonly,
>        final ISingleDisplay display,
>        final IModel model,
>        final Page callingPage
>    )
>    {
>        super( id );
>
>        add( new FeedbackPanel ("feedback" ) );
>
>        final Form form = new Form( "SingleItemFormName" );
>        // Call here has no effect
>        if( callingPage != null ) {
>            form.setResponsePage( callingPage );
>        }
>
>        RepeatingView rv = new RepeatingView( "SingleItemFormContents" );
>        for( Iterator views = display.getViews( ).iterator( );
> views.hasNext(
> ); ) {
>            IView view = (IView) views.next( );
>            rv.add( new FieldSetView( rv.newChildId( ), readonly, display,
> model, view )  );
>        }
>        form.add( rv );
>
>        form.add( new SubmitLink( "link1" ) {
>            public void onSubmit( ) {
>                display.getData( ).saveItem( model.getObject( ) );
>                // Call here works
>                if( callingPage != null ) {
>                    form.setResponsePage( callingPage );
>                }
>            }
>        } );
>
>        add( form );
>    }
>
> }
>
>
>
> On Tue, Mar 25, 2008 at 11:32 AM, Johan Compagner <[EMAIL PROTECTED]>
> wrote:
>
> > do you have some sample code??
> > what do you mean with setResponsePage outside of an onSubmit or click?
> > outside of what? when is it called?
> >
> > On Tue, Mar 25, 2008 at 12:22 PM, Eric Rotick <[EMAIL PROTECTED]>
> > wrote:
> >
> > > I have a page with many buttons to do different things. I decided the
> > best
> > > strategy was to setup the default page via a call to setReponsePage at
> > the
> > > start of the page and then overrride this in the onSubmit method for
> > each
> > > button.
> > >
> > > This appears not to work. However, if I set a value of the default
> page
> > > and
> > > override this value in the onSubmit method of each button and then
> only
> > > call
> > > the setResponsePage in the obSubmit method for the form then it works.
> > > I've
> > > also tried only making the call to setResponsePage in the onSubmit or
> > > onClick methods and this works.
> > >
> > > In summary, a call to setReponsePage outside of an onSubmit or onClick
> > > appears to have no effect.
> > >
> > > Is this correct and if so why? I can't find any docs to suggest not
> > using
> > > this strategy.
> > >
> >
>

Reply via email to