AjaxSubmitLink not working when fileUpload in Form
Hi, When I am having a fileUpload in a form, the wicket ajax debug throw the following error: An error occurred while executing Ajax request:TypeError: object is not a function and my ajaxsubmitlink actions onSubmit() or onError() are not called (so nothing happens). I am not sure if I am doing something wrong, if this is expected or if this is a bug. Here is a simple code that I used: TestPage.java: public final class TestPage extends PersistancePanel { public TestPage(String id, Eventmgr em) { super(id); Form form = new TestPage.TestPageForm(eventCreationForm, em); form.setMultiPart(true); // Enable multipart mode (need for uploads file) form.setMaxSize(Bytes.kilobytes(128)); form.setModel(new CompoundPropertyModel(em)); add(form); } public final class TestPageForm extends FormEventmgr { public TestPageForm(final String id, Eventmgr eventMgr) { super(id); add(new FileUploadField(fileUpload)); final WebMarkupContainer wmc2 = new WebMarkupContainer(wmc); wmc2.setOutputMarkupId(true); RefreshingView rv = new RefreshingViewEvent(subEventForm) { @Override //protected void populateItem(ListItem item) { protected void populateItem(ItemEvent item) { final Event event = (Event) item.getModelObject(); item.add(new TextArea(descr2, new PropertyModelString(event, descr))); } @Override protected IteratorIModellt;Event getItemModels() { return eventMgr.getILevents().iterator(); } }; rv.setItemReuseStrategy(new ReuseIfModelsEqualStrategy()); wmc2.add(rv); add(wmc2); AjaxSubmitLink addSubevent = new AjaxSubmitLink(addSubevent, this) { @Override public void onSubmit(AjaxRequestTarget target, Form form) { eventMgr.getEvents().add(new Event()); System.out.println(OK); target.add(wmc2); } }; addSubevent.setDefaultFormProcessing(false); add(addSubevent); } @Override protected void onSubmit() { System.out.println(submit done); } } } TestPage.html html xmlns:wicket head meta http-equiv=Content-Type content=text/html; charset=UTF-8/ titleCreateEvent/title /head body wicket:panel form wicket:id=eventCreationForm strongwicket:message key=event.addposter/: /strong input wicket:id=fileUpload type=file/ div wicket:id=wmc wicket:message key=event.description/: textarea name=description2 wicket:id=descr2 rows=2 cols=40/textarea /div + # wicket:message key=event.subevent.add/ br/ input type=submit name=submit/ /form /wicket:panel /body /html Thank you for your help, Cojy. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-not-working-when-fileUpload-in-Form-tp4667740.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxSubmitLink not working when fileUpload in Form
Hi, The demo example at http://www.wicket-library.com/wicket-examples-6.0.x/ajax/upload seems to work fine. Take a look at its code (wicket-examples module) and see what is different with your code. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Sun, Sep 28, 2014 at 10:25 AM, cojy c...@hotmail.fr wrote: Hi, When I am having a fileUpload in a form, the wicket ajax debug throw the following error: An error occurred while executing Ajax request:TypeError: object is not a function and my ajaxsubmitlink actions onSubmit() or onError() are not called (so nothing happens). I am not sure if I am doing something wrong, if this is expected or if this is a bug. Here is a simple code that I used: TestPage.java: public final class TestPage extends PersistancePanel { public TestPage(String id, Eventmgr em) { super(id); Form form = new TestPage.TestPageForm(eventCreationForm, em); form.setMultiPart(true); // Enable multipart mode (need for uploads file) form.setMaxSize(Bytes.kilobytes(128)); form.setModel(new CompoundPropertyModel(em)); add(form); } public final class TestPageForm extends FormEventmgr { public TestPageForm(final String id, Eventmgr eventMgr) { super(id); add(new FileUploadField(fileUpload)); final WebMarkupContainer wmc2 = new WebMarkupContainer(wmc); wmc2.setOutputMarkupId(true); RefreshingView rv = new RefreshingViewEvent(subEventForm) { @Override //protected void populateItem(ListItem item) { protected void populateItem(ItemEvent item) { final Event event = (Event) item.getModelObject(); item.add(new TextArea(descr2, new PropertyModelString(event, descr))); } @Override protected IteratorIModellt;Event getItemModels() { return eventMgr.getILevents().iterator(); } }; rv.setItemReuseStrategy(new ReuseIfModelsEqualStrategy()); wmc2.add(rv); add(wmc2); AjaxSubmitLink addSubevent = new AjaxSubmitLink(addSubevent, this) { @Override public void onSubmit(AjaxRequestTarget target, Form form) { eventMgr.getEvents().add(new Event()); System.out.println(OK); target.add(wmc2); } }; addSubevent.setDefaultFormProcessing(false); add(addSubevent); } @Override protected void onSubmit() { System.out.println(submit done); } } } TestPage.html html xmlns:wicket head meta http-equiv=Content-Type content=text/html; charset=UTF-8/ titleCreateEvent/title /head body wicket:panel form wicket:id=eventCreationForm strongwicket:message key=event.addposter/: /strong input wicket:id=fileUpload type=file/ div wicket:id=wmc wicket:message key=event.description/: textarea name=description2 wicket:id=descr2 rows=2 cols=40/textarea /div + # wicket:message key=event.subevent.add/ br/ input type=submit name=submit/ /form /wicket:panel /body /html Thank you for your help, Cojy. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-not-working-when-fileUpload-in-Form-tp4667740.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
DownloadLink in a separate thread?
Just checking to see if I'm doing this right: When users click on a download link on my Wicket application, I want to be zip all the files in a directory on the fly and return the user one big *.zip file. This is working as expected, but since the number of and size of files can be quite big, this can take a while to process. Is DownloadLink the right wicket component to implement this? Does it make sense to run this in a separate thread? Any help is appreciated! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DownloadLink-in-a-separate-thread-tp4667743.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket meet-and-greet at JavaOne 2014?
It turns out that I'll still be out of the country trying to address a few things, so I'm going to miss JavaOne altogether. But if any of you is ever in San Francisco at any time, please drop me a note and we can grab a drink and chat about web application frameworks. Best, Garret On 9/8/2014 8:17 PM, Garret Wilson wrote: Hi, all. I'm traveling at the moment, but I plan to be back in San Francisco around the start of JavaOne. Do any Wicket users plan on being in town for the conference? Would you like me to organize a meet-and-greet at a local restaurant or even (depending on the number of guests) at my place? Perhaps it would be helpful and fun to put some faces with some names on the list. Let me know if you like the idea. Best, Garret - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DownloadLink in a separate thread?
Never mind. I found my solution by using AbstractResource and ResourceLink instead of DownloadLink for nonblocking operation. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DownloadLink-in-a-separate-thread-tp4667743p4667749.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org