I keep wondering, too, what you are doing in the wizard that needs an
editing modal popup.  Typically, wizards are used for multi-step forms.  So
to me it's weird to have a wizard that isn't the form - but displays values
that you are then editing from a modal.  Just curious....

--
Jeremy Thomerson
http://www.wickettraining.com



On Fri, Oct 9, 2009 at 11:35 AM, Jeremy Thomerson <jer...@wickettraining.com
> wrote:

> Some very brief pseudo code.  Let us know if you need more detail.
>
> public MyWizard(IModel<Foo> model) {
> setModel(new Model<Foo>(model.getObject());
> .... initialize wizard steps - passing them this.getModel() so they all use
> the same model ....
> }
>
> make sure to pass all of your wizard steps AND the form inside your modal
> the same model.
>
> Then, in your wizard step and form, use property models (or a compound
> property model):
>
> new MyStep(IModel<Foo> model) {
> setModel(model);
> add(new Label("firstName", new PropertyModel(model, "firstName"));
> .. or ..
> setModel(new CompoundPropertyModel(model));
> add(new Label("firstName");
> }
>
>
> new MyForm(IModel<Foo> model) {
> setModel(model);
> add(new TextField("firstName", new PropertyModel(model, "firstName"));
> .. or ..
> setModel(new CompoundPropertyModel(model));
> add(new TextField("firstName");
> }
>
> By doing this, your modal form will actually update the object that is also
> backing the wizard.  Then, you should just be able to submit the form, close
> the modal, and add the wizard step components to the ajax request (so that
> they will be repainted). When they are repainted, they will pull the values
> from the model object, which was updated by your form.
>
> If you hit a wall with that, you *may* have to set the model on your wizard
> step to the model from your form.  For instance:
>
> // in your ajax submit:
> MyStep.this.setModel(form.getModel())
> target.addComponent(MyStep.this.panelThatShowsYourStuff)
> // close modal
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Fri, Oct 9, 2009 at 11:24 AM, Jeffrey Schneller <
> jeffrey.schnel...@envisa.com> wrote:
>
>> I have a modal inside a wizard step.  The modal is displaying and
>> showing data.  The modal is using a panel and not a page.  The panel for
>> the modal contains a form with text fields.  The wizard step contains
>> labels.
>>
>>
>>
>> I want to have a save and a cancel button in the modal.  The save should
>> take the values from the text fields and update the model in the wizard
>> step.  The wizard step should now show the updated values in the label.
>>
>>
>>
>> I tried implementing an AjaxButton in the panel for the modal but it
>> never does anything.
>>
>>
>>
>> How would one do this?  Example code, pseudo-code?
>>
>>
>>
>> Thanks.
>>
>>
>>
>>
>

Reply via email to