I am using the modal window with a panel which sits inside a wizard. Here is my code because I am out of ideas and need a solution. The dropdown with the onchange is working and is updating the first name with the value from the selected object in the dropdown. The Popup is not getting the same data from the model. I keep getting first name being null even after the first name is shown correctly after choosing in the dropdown.
I am using Guice. I am not using Spring and have no plans to use Spring. <rant> I like the Wicket framework but am becoming increasingly annoyed and losing faith in it. Easy things to develop are taking way too long and require more and more crap thrown at it to get it to work. I have built multiple large sites with jsp/servlets/javascript/ajax that are 1000x more complex than what I am trying to do with less headaches. </rant> That being said here is the code that I have. Hopefully someone can help me. STEP1 - extends WizardStep public Step1(String name, String summary, IModel model) { super(new Model(name), new Model(summary), model); final Label fname = new Label("name.firstName"); fname.setOutputMarkupId(true); add(fname); add(new Label("name.middleName").setOutputMarkupId(true)); add(new Label("name.lastName").setOutputMarkupId(true)); add(new Label("adminName").setOutputMarkupId(true)); // Dropdown to choose a person if the account has more than one person tied to it List people = dao.findById(MySession.get().getAccountId()).getPeople(); DropDownChoice peopleSelect = new DropDownChoice("people", people, new PeopleChoiceRenderer("lastName", "id")); peopleSelect.setRequired(true); peopleSelect.setNullValid(false); peopleSelect.add(new AjaxFormComponentUpdatingBehavior("onchange") { protected void onUpdate(AjaxRequestTarget target) { RequestForm rf = (RequestForm) getDefaultModelObject(); if (rf.getPeople() != null) { rf.getName().setFirstName(rf.getPeople().getFirstName()); target.addComponent(fname); } } }); add(peopleSelect); final ModalWindow editPopup = new ModalWindow("modal"); add(editPopup); final ModifyPeoplePanel editPopupPanel = new ModifyPeoplePanel(editPopup.getContentId(), model); editPopup.setContent(editPopupPanel); editPopup.setTitle("Modify People Info"); editPopup.setCookieName("peopleModify"); AjaxLink modifyLink = new AjaxLink("modify") { @Override public void onClick(AjaxRequestTarget target) { editPopup.show(target); } }; add(modifyLink); } MODIFYPEOPLEPANEL- class that extends panel public ModifyPeoplePanel(String id, IModel model) { super(id, model); Form form = new ModifyPeopleForm("modifyPeople", model); add(form); } public class ModifyPeopleForm extends Form { public ModifyPeopleForm(String id, IModel model) { super(id, model); add(new RequiredTextField<String>("name.firstName")); add(new RequiredTextField<String>("name.middleName")); add(new RequiredTextField<String>("name.lastName")); add(new RequiredTextField<String>("adminName")); } } -----Original Message----- From: Michael O'Cleirigh [mailto:michael.ocleir...@rivulet.ca] Sent: Thursday, October 08, 2009 11:00 AM To: users@wicket.apache.org Subject: Re: Showing Modal window within a wizard step Hi Jeffrey, Due to the way pages are serialized models don't work right is shared between pages. There are two kinds of modal windows and one of them is a page that is rendered on your page through an IFRAME. If the model data is not appearing its because you are using the page type. You will have to wire up the panel on the modal window to use a model that knows how to get the same object that is being used in the wizard step. I've used a spring session scoped bean for this type of synchronization before. i.e. You create an IModel that loads and stores the object from the spring bean which will make the data the same in both the wizard step and the modal window. Regards, Mike Passing a model between a page to modal window is the same as passing a model between pages > Ok. How do I use the same model? The model I have on step 1 if I pass > it into the modal window I get no data in the model. This was my > original thought on how to do it but something isn't right. > > And yes I know the wiki example refers to a "chooserPanel" and in my > case it is an "editorPanel". I didn't expect the wiki to be the exact > code that I needed but a starting example. > > > > -----Original Message----- > From: Pedro Santos [mailto:pedros...@gmail.com] > Sent: Thursday, October 08, 2009 7:03 AM > To: users@wicket.apache.org > Subject: Re: Showing Modal window within a wizard step > > Hi Jeffrey, the wiki example refers to an "chooserPanel", that is not > the > case of your "editorPanel". Simple use the same model on step 1 on your > Modal window. > > On Wed, Oct 7, 2009 at 5:19 PM, Jeffrey Schneller < > jeffrey.schnel...@envisa.com> wrote: > > >> I am trying to show a modal window within a wizard step showing the >> > same > >> data the wizard step shows but as input text fields for editing. I >> > have > >> found some references to showing a wizard in a modal window and >> > showing > >> a wizard within a wizard but not what I am looking to do. >> >> >> >> I have the wizard steps appearing with the data and I have a modal >> > popup > >> being launched from the step via an AjaxLink. I can't figure out how >> > to > >> get the data from the wizard step and make it appear in the modal as >> well [so the user can edit the information]. >> >> >> >> I have a MyWizard object which in the constructor sets the default >> > model > >> to a CompoundPropertyModel of a LoadableDetachableModel of my data >> object. I then call a method in the constructor to set all the data >> > of > >> the model that I can from the database [which works]. >> >> >> >> The first step of the wizard shows any data that has been set in the >> model. >> >> >> >> How do I get my Modal window to show the same data from the model used >> to display data in step 1? >> >> >> >> I then will need to take the values entered in the modal and push them >> back into the wizard model. I am assuming this can be done via an >> > entry > >> in the wiki [1]. >> >> >> >> Thanks. >> >> >> >> [1] >> >> > http://cwiki.apache.org/WICKET/pass-form-input-from-modal-window-back-to > > -the-caller-page.html<http://cwiki.apache.org/WICKET/pass-form-input-fro > m-modal-window-back-to%0A-the-caller-page.html> > >> >> >> >> >> >> >> >> >> >> >> > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org