2

I have a page to capture personal details and the number of persons are dynamic. I have tried using AjaxTabbedPanel for the implementation. I am losing the raw data in each tab when I add a new tab to the tabPanel. I would like to retain the values in the previous tabs even when I add a new tab. And I do not want to submit the form too until the information about every person is entered. Any other suggestion is also appreciated. Thanks in advance.

List<ITab> tabs = new ArrayList<ITab>();
Set<Borrower> borrowers;
AjaxTabbedPanel ajaxTabbedPanel;
Form form = new Form("mainForm");
form.add(new AjaxLink("addBorrower") {
    @Override
    public void onClick(AjaxRequestTarget ajaxRequestTarget) {
      tabs.add(new AbstractTab(new Model(panelId)) {
            public Panel getPanel(String panelId) {
                return new BorrowerInfoComponent(panelId);
            }
        });
    ajaxRequestTarget.addComponent(ajaxTabbedPanel);                
  }
});
tabs.add(new AbstractTab(new Model("borr1")) {
     public Panel getPanel(String panelId) {
    return new BorrowerInfoComponent(panelId);
    }
});
ajaxTabbedPanel = new AjaxTabbedPanel("tabs", tabs);
form.add(ajaxTabbedPanel);
add(form);

Here, whenever i add an new tab(borrower) the data entered in the previous borrower tab is lost.

Mibin
  • 31
  • 3

0 Answers0