ajax - wicke 6 AjaxLink within a Form -



ajax - wicke 6 AjaxLink within a Form -

in application written in wicket 6, (as wicket newbie) trying utilize ajaxlink within form in order able update contents of form.

my utilize case next : through ajax want able add/remove dynamically controls (file upload controls) form.

when using ajaxlink, not able create ajax phone call in order add together new upload file command form. on other hand, when utilize ajaxfallbacklink request gets submitted server , new command submitted. downside in case values selected on form (the country country dropdown) lost.

can explain me how can cleanly add/remove controls form, ajax, without affecting other values selected on form?

bellow simplified version of form class :

private final class myform extends baseform<myformbean> { private static final long serialversionuid = -9021809835323626044l; private list<image> sfimages = new arraylist<>(); private myform(final string id, sample sample) { super(id, new compoundpropertymodel<>(new myformbean(sample))); setoutputmarkupid(true); setmarkupid(id); setmultipart(true); addwithfeedbackcontainerandlabel(new countrydropdownchoice("country").setrequired(true)); final webmarkupcontainer ajaxcontainer = new ajaxupdatablecontainer("ajaxcontainer"); add(ajaxcontainer); ajaxcontainer.add(new listview<image>("sfimages", sfimages) { @override public void populateitem(final listitem<image> listitem) { listitem.add(new uploadimagepanel("sfimage")); } }); add(new ajaxlink("addsfimage") { private static final long serialversionuid = 974013580329804810l; @override public void onclick(ajaxrequesttarget target) { system.out.println("ajax magic"); myform.this.sfimages.add(new dynamicimage("53a4c88f78306456988af612")); if (target != null) { target.add(ajaxcontainer); } } }); button button = new savebutton("savebutton"); add(button); }

ajax wicket

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -