Dear all After try-error, I built an working example.
testpage.html <div class="container clearfix"> <div class="content-wrap"> <form wicket:id="form"></form> <div class="col_half"> <button type="button" wicket:id="btnAdd" class="btn btn-block btn-success">Add</button> </div> <div class="col_half col_last"> <button type="button" wicket:id="btnRemove" class="btn btn-block btn-danger">Remove</button> </div> </div> <form wicket:id="container"> <div wicket:id="rows" class="container clearfix"> <input type="text" wicket:id="uri" class="sm-form-control" placeholder="請輸入Redirect URI"/> </div> </form> <button type="submit" wicket:id="btnSubmit" class="btn btn-info">Submit</button> </div> testpage.java public class Test2Page extends BasePage { private static final Logger logger = LoggerFactory.getLogger(Test2Page.class); private Form form, container; private List<String> uri; private List<String> redirecturi; private AjaxSubmitLink btnAdd, btnSubmit, btnRemove; public Test2Page(PageParameters parameters) { super(parameters); redirecturi = new ArrayList(); uri = new ArrayList(); uri.add(""); IModel<List<String>> model = new LoadableDetachableModel<List<String>>() { @Override protected List<String> load() { return uri; } }; container = new StatelessForm("container"); container.setOutputMarkupId(true); container.setDefaultModel(new CompoundPropertyModel(this)); container.add(new ListView<String>("rows", model) { @Override protected void populateItem(ListItem<String> listItem) { listItem.add(new TextField("uri", listItem.getModel())); } }); btnSubmit = new AjaxSubmitLink("btnSubmit", container) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { super.onSubmit(target, form); logger.info("Form Data : {}", uri); } }; form = new StatelessForm("form"); btnAdd = new AjaxSubmitLink("btnAdd", container) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { super.onSubmit(target, form); logger.info("Form Data : {}", uri); uri.add(""); target.add(container); } }; btnRemove = new AjaxSubmitLink("btnRemove", container) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { super.onSubmit(target, form); logger.info("Form Data Before: {}", uri); uri.remove(uri.size() - 1); logger.info("Form Data Before: {}", uri); target.add(container); } }; add(form, btnAdd, btnRemove, btnSubmit, container); } public List<String> getUri() { return uri; } public void setUri(List<String> uri) { this.uri = uri; } public List<String> getRedirecturi() { return redirecturi; } public void setRedirecturi(List<String> redirecturi) { this.redirecturi = redirecturi; } } On Fri, Apr 6, 2018 at 8:53 AM, Shengche Hsiao <shengchehs...@gmail.com> wrote: > Thanks, Maxim. > > On Fri, Apr 6, 2018 at 8:45 AM, Maxim Solodovnik <solomax...@gmail.com> > wrote: > >> The idea is: to >> create list >> Draw it >> On button click add another item to list >> Redraw it >> >> WBR, Maxim >> (from mobile, sorry for the typos) >> >> On Fri, Apr 6, 2018, 07:29 Shengche Hsiao <shengchehs...@gmail.com> >> wrote: >> >> > Yep, thanks, I'll try. >> > >> > On Fri, Apr 6, 2018 at 8:22 AM, Maxim Solodovnik <solomax...@gmail.com> >> > wrote: >> > >> > > So you need something like: "add new row" functionality? >> > > This can be done with listview for example >> > > >> > > WBR, Maxim >> > > (from mobile, sorry for the typos) >> > > >> > > On Fri, Apr 6, 2018, 06:56 Shengche Hsiao <shengchehs...@gmail.com> >> > wrote: >> > > >> > > > Because I don't know how many rows users may required. >> > > > >> > > > But using invisible input is an bright way to do, thank you Maxim. >> > > > >> > > > On Thu, Apr 5, 2018 at 11:33 PM, Maxim Solodovnik < >> > solomax...@gmail.com> >> > > > wrote: >> > > > >> > > > > Why to produce the input and not start with invisible input (on >> > server >> > > > > side) >> > > > > And show it onclick? >> > > > > >> > > > > On Thu, Apr 5, 2018 at 8:39 PM, Shengche Hsiao < >> > > shengchehs...@gmail.com> >> > > > > wrote: >> > > > > > Dear All >> > > > > > >> > > > > > >> > > > > > I want to design a form with an button, that when click it will >> > > > produce a >> > > > > > new input text filed within form, and retrieve it in server >> side. I >> > > > tried >> > > > > > listview, but cannot work. I also cannot find relevant examples >> on >> > > > > > stackoverflow, any suggestion? >> > > > > > >> > > > > > >> > > > > > -- >> > > > > > >> > > > > > >> > > > >> > ------------------------------------------------------------ >> -----------> >> > > > > > We do this not because it is easy. We do this because it is >> hard. >> > > > > > >> > > > >> > ------------------------------------------------------------ >> -----------> >> > > > > > ShengChe Hsiao >> > > > > > >> > > > >> > ------------------------------------------------------------ >> -----------> >> > > > > > front...@gmail.com >> > > > > > front...@tc.edu.tw >> > > > > > >> > > > >> > ------------------------------------------------------------ >> -----------> >> > > > > > VoIP : 070-910-2450 >> > > > > > >> > > > >> > ------------------------------------------------------------ >> -----------> >> > > > > >> > > > > >> > > > > >> > > > > -- >> > > > > WBR >> > > > > Maxim aka solomax >> > > > > >> > > > > ------------------------------------------------------------ >> --------- >> > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> > > > > For additional commands, e-mail: users-h...@wicket.apache.org >> > > > > >> > > > > >> > > > >> > > > >> > > > -- >> > > > >> > > > >> > ------------------------------------------------------------ >> -----------> >> > > > We do this not because it is easy. We do this because it is hard. >> > > > >> > ------------------------------------------------------------ >> -----------> >> > > > ShengChe Hsiao >> > > > >> > ------------------------------------------------------------ >> -----------> >> > > > front...@gmail.com >> > > > front...@tc.edu.tw >> > > > >> > ------------------------------------------------------------ >> -----------> >> > > > VoIP : 070-910-2450 >> > > > >> > ------------------------------------------------------------ >> -----------> >> > > > >> > > >> > >> > >> > >> > -- >> > >> > ------------------------------------------------------------ >> -----------> >> > We do this not because it is easy. We do this because it is hard. >> > ------------------------------------------------------------ >> -----------> >> > ShengChe Hsiao >> > ------------------------------------------------------------ >> -----------> >> > front...@gmail.com >> > front...@tc.edu.tw >> > ------------------------------------------------------------ >> -----------> >> > VoIP : 070-910-2450 >> > ------------------------------------------------------------ >> -----------> >> > >> > > > > -- > > -----------------------------------------------------------------------> > We do this not because it is easy. We do this because it is hard. > -----------------------------------------------------------------------> > ShengChe Hsiao > -----------------------------------------------------------------------> > front...@gmail.com > front...@tc.edu.tw > -----------------------------------------------------------------------> > VoIP : 070-910-2450 > -----------------------------------------------------------------------> > -- -----------------------------------------------------------------------> We do this not because it is easy. We do this because it is hard. -----------------------------------------------------------------------> ShengChe Hsiao -----------------------------------------------------------------------> front...@gmail.com front...@tc.edu.tw -----------------------------------------------------------------------> VoIP : 070-910-2450 ----------------------------------------------------------------------->