I don't know if the code will help, if it doesn't please just disregard it and answer my question
regards Wojtek 2008/3/5, Wojciech Biela <[EMAIL PROTECTED]>: > Hello > > This time my question is not so general. > > We have a big form, part of this form there is a component which > should be a dynamic list of fields like this: > > |TextField| - remove > |TextField| - remove > |TextField| - remove > |TextField| - add > > if you click "add" another row "|TextField| - remove" should appear at > the bottom, it you should click "remove" then this row should be > removed > > problem we have is that the "add" and "remove" link does not send the > form, it only sends and ajax request to add an element to the list of > components and it operates (target) on a DIV that wraps the whole > list, so afterwards it renders the list again loosing values that were > already put in > > what is the preferred method to do such a thing? should the add and > remove link be a submit link with defaultFormProcessing set to false? > or maybe should we try to save values to model objects onchange in the > respective fields themselves > > isn't there a way to do it in a neat fashion? > > code responsible for the list component is > > wrapper = new WebMarkupContainer("attributes-wrapper"); > listView = new ListView("attributes", attributeValuesList) { > public void populateItem(final ListItem listItem) { > final AttributeValue attributeValue = (AttributeValue) > listItem.getModelObject(); > Renderer inputRenderer = > attributeValue.getAttribute().getInputRenderer(); > Component component = inputRenderer.getComponent(attributeValue); > listItem.add(component); > AjaxLink addLink = new AddLink("add-link"); > AjaxLink removeLink = new RemoveLink("remove-link", listItem); > if (listItem.getIndex() < (listView.getViewSize() - 1)) { > addLink.setVisible(false); > } else { > removeLink.setVisible(false); > } > listItem.add(addLink); > listItem.add(removeLink); > } > }; > wrapper.setOutputMarkupId(true); > > HTML is > > <div wicket:id="attributes-wrapper" class="composit-wrapper"> > <div wicket:id="attributes" class="composit"> > <div wicket:id="attributeAndValue" > class="composit-item"></div> > <div class="composit-links"> > <a wicket:id="add-link">+ add</a> > <a wicket:id="remove-link">- remove</a> > </div> > </div> > </div> > > > -- > Wojtek Biela > -- Wojtek Biela --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]