How to add checkboxes with AJAX?
Hi, I am trying to write a FormComponentPanel that displays a list of checkboxes, a textfield and a button. It shall return the selected values. I want to use the textfield and the button to add new checkboxes dynamically using AJAX. I used a CheckGroup together with a ListView to render the checkboxes. Below the checkboxes I placed a TextField and an AjaxButton. Now I want to be able to enter a value into the textfield and after a click on the button the entered value shall be added to the list. How can I accomplish this? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-add-checkboxes-with-AJAX-tp4667452.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: How to add checkboxes with AJAX?
This is what it should look like: http://apache-wicket.1842946.n4.nabble.com/file/n4667453/formcomponentpanel1.png http://apache-wicket.1842946.n4.nabble.com/file/n4667453/formcomponentpanel2.png http://apache-wicket.1842946.n4.nabble.com/file/n4667453/formcomponentpanel3.png -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-add-checkboxes-with-AJAX-tp4667452p4667453.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
How to register a global resource with dependencies?
Hi,I want to register a JS file globally, but it depends on jQuery. The user guide says that rsources can be registered with getSharedResources().add(String name, IResource resource). But since it takes an IResource, I can not declare the dependencies with overriding getDependencies() like I would do with a ResourceReference. So how can I register a global JavaScript resource that depends on jQuery? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403.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: How to register a global resource with dependencies?
Thanks for your answer. So everytime I want to reference a resource, I have to declare its dependencies? I want to register it globally, because I can use it on different pages then and if the path to the resource changes in the future, I only need to update it at one place. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403p4667407.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: How to register a global resource with dependencies?
Okay, then I have another question: Where do I have to define the references. Until now, I always defined them in the component that needs them. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403p4667411.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: AjaxFormComponentUpdatingBehavior is not working
This is the produced HTML for selSupplier: lt;select name=parameterPanel:selSupplier id=selSupplier9gt; lt;option value=0gt;Supplier 0lt;/optiongt; lt;option value=1gt;Supplier 1lt;/optiongt; lt;option value=2gt;Supplier 2lt;/optiongt;lt;option value=3gt;Supplier 3lt;/optiongt; lt;option value=4gt;Supplier 4lt;/optiongt; lt;option value=5gt;Supplier 5lt;/optiongt; lt;option value=6gt;Supplier 6lt;/optiongt;lt;option value=7gt;Supplier 7lt;/optiongt; lt;option value=8gt;Supplier 8lt;/optiongt; lt;option value=9gt;Supplier 9lt;/optiongt;lt;/selectgt; This is the generated HTML of my test-page which is working: lt;!DOCTYPE htmlgt;lt;html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.orggt;lt;headgt;lt;script type=text/javascript src=./wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-1.11.1-ver-1407233400871.jsgt;lt;/scriptgt;lt;script type=text/javascript src=./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-1407233400871.jsgt;lt;/scriptgt;lt;script type=text/javascript src=./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-ver-1407233400871.jsgt;lt;/scriptgt;lt;script type=text/javascript src=./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-debug-ver-1407233400871.jsgt;lt;/scriptgt;lt;script type=text/javascript id=wicket-ajax-debug-enablegt;/*lt;![CDATA[*/Wicket.Ajax.DebugWindow.enabled=true;/*]]gt;*/lt;/scriptgt;lt;script type=text/javascript id=wicket-ajax-base-urlgt;/*lt;![CDATA[*/Wicket.Ajax.baseUrl=?0;/*]]gt;*/lt;/scriptgt;lt;meta http-equiv=Content-Type content=text/html; charset=UTF-8gt;lt;titlegt;WicketTestlt;/titlegt;lt;script type=text/javascript gt;/*lt;![CDATA[*/Wicket.Event.add(window, domready, function(event) { Wicket.Ajax.ajax({u:./?0-2.IBehaviorListener.0-form-panel-plantType,e:change,c:plantType1,ad:true,m:POST});;;});/*]]gt;*/lt;/scriptgt;lt;/headgt;lt;bodygt; lt;form wicket:id=form id=form2 method=post action=./?0-2.IFormSubmitListener-formgt;lt;div style=width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hiddengt;lt;input type=hidden name=form2_hf_0 id=form2_hf_0 /gt;lt;/divgt; lt;wicket:container wicket:id=panelgt;lt;wicket:panelgt; lt;select wicket:id=plantType name=panel:plantType id=plantType1gt;lt;option selected=selected value=gt;Bitte wählenlt;/optiongt;lt;option value=0gt;Obstlt;/optiongt;lt;option value=1gt;Gemüselt;/optiongt;lt;/selectgt;lt;select wicket:id=plants name=panel:plants id=plants3gt;lt;option selected=selected value=gt;Bitte wählenlt;/optiongt;lt;/selectgt; lt;/wicket:panelgt;lt;/wicket:containergt; lt;/formgt;lt;/bodygt;lt;/htmlgt; But the HTML of my original application does not contain a single lt;scriptgt; tag. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-is-not-working-tp4666877p4666888.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: AjaxFormComponentUpdatingBehavior is not working
No I do not use any Decorator. I have another page where I am using an AjaxSelfUpdatingTimerBehavior which updates the contents of the page periodically. All components of this page are in the same project. The page is working and updates its contents every 2 seconds. Also the lt;scriptgt; tags are available in the generated HTML. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-is-not-working-tp4666877p4666890.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: AjaxFormComponentUpdatingBehavior is not working
I have done a terrible mistake... I have been working on an old file that actually was not invoked in the current version of the webapp. Everything is working as expected. I am so sorry for wasting your time :-( Thank you very much for trying to help me anyways. Once again sorry! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-is-not-working-tp4666877p4666892.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
AjaxFormComponentUpdatingBehavior is not working
I am building a webapp based on Wicket. I have a WebPage that contains a StatelessForm which contains a FormComponentPanel. The FormComponentPanel is provided by a different library. This works fine without any AJAX-stuff. But now I want to react to onchange-events of a DropDownChoice and thus I added a AjaxFormComponentUpdatingBehavior to my DropDownChoice. This is a excerpt of my FormComponentPanel: public class ParameterForm extends FormComponentPanelMaplt;String, String { private final DropDownChoice selSupplier; private final DropDownChoice selProjects; public ParameterForm(final String id, final List suppliers, final List projects) { super(id); selSupplier = new DropDownChoice(selSupplier, Model.of(), new ListModel(suppliers)); selProjects = new DropDownChoice(selProjects, Model.of(), new ListModel(projects)); setModel(new MapModel()); selSupplier.setOutputMarkupid(true);} @Override protected void onInitialize() {super.onInitialize(); selSupplier.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 7643295763275649586L;@Override protected void onUpdate(final AjaxRequestTarget target) { System.out.println(selSupplier.getConvertedInput());} }); add(selSupplier); add(selProjects); }} Now I would expect to get a message on the command-line when I select another item, but nothing happens. Wicket does not put any script-tags into the generated HTML and I do not see the WICKET AJAX DEBUG-button. Can someone tell me what I am doing wrong? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-is-not-working-tp4666877.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: AjaxFormComponentUpdatingBehavior is not working
Sorry I have finished work for today, I will post the output tomorrow. The generated HTML does not contain any script tags, so no JavaScript is loaded. Wicket is in DEV mode. I created another Wicket application and also used a StatelessForm, FormComponentPanel, two DropDownChoices and an AjaxFormComponentUpdatingBehavior. On this test-page everything works as expected. The only difference is that both the page and the panel are in the same project. I get no exceptions in the logs and the browsers console shows nothing. Am 05.08.2014 14:07 schrieb Martin Grigorov-4 [via Apache Wicket] ml-node+s1842946n4666878...@n4.nabble.com: Hi, By using Ajax behavior/component you make the page stateful. I guess you want it to be stateless (because you use StatelessForm). Aren't there any errors in the server logs or in the browser's JS console ? Wicket Ajax Debug console appears only in DEV mode and only when there is an Ajax behavior in the page. What do you mean by there are no script elements in the produced html ? What is the produced markup for selSupplier component ? Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Tue, Aug 5, 2014 at 1:58 PM, brushmate [hidden email] http://user/SendEmail.jtp?type=nodenode=4666878i=0 wrote: I am building a webapp based on Wicket. I have a WebPage that contains a StatelessForm which contains a FormComponentPanel. The FormComponentPanel is provided by a different library. This works fine without any AJAX-stuff. But now I want to react to onchange-events of a DropDownChoice and thus I added a AjaxFormComponentUpdatingBehavior to my DropDownChoice. This is a excerpt of my FormComponentPanel: public class ParameterForm extends FormComponentPanelMaplt;String, String { private final DropDownChoice selSupplier; private final DropDownChoice selProjects; public ParameterForm(final String id, final List suppliers, final List projects) { super(id); selSupplier = new DropDownChoice(selSupplier, Model.of(), new ListModel(suppliers)); selProjects = new DropDownChoice(selProjects, Model.of(), new ListModel(projects)); setModel(new MapModel()); selSupplier.setOutputMarkupid(true);} @Override protected void onInitialize() {super.onInitialize(); selSupplier.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 7643295763275649586L; @Override protected void onUpdate(final AjaxRequestTarget target) { System.out.println(selSupplier.getConvertedInput()); } }); add(selSupplier); add(selProjects); }} Now I would expect to get a message on the command-line when I select another item, but nothing happens. Wicket does not put any script-tags into the generated HTML and I do not see the WICKET AJAX DEBUG-button. Can someone tell me what I am doing wrong? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-is-not-working-tp4666877.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: [hidden email] http://user/SendEmail.jtp?type=nodenode=4666878i=1 For additional commands, e-mail: [hidden email] http://user/SendEmail.jtp?type=nodenode=4666878i=2 -- If you reply to this email, your message will be added to the discussion below: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-is-not-working-tp4666877p4666878.html To unsubscribe from AjaxFormComponentUpdatingBehavior is not working, click here http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4666877code=YnJ1c2htYXRlQGdtYWlsLmNvbXw0NjY2ODc3fC05MTIzMjM2MzY= . NAML http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-is-not-working-tp4666877p4666881.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