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