Re: Ajax-y interactions inside a form
Linda van der Pal ha scritto: Well I'm not too familiar with this area of Wicket, but there's also AjaxLink "which is similar to Link, but sends a request using Ajax"*. Which means it doesn't submit like AjaxSubmitLink does. That's why I'm using an AjaxSubmitLink in my example (attached to the first mail). Still, I'm looking for a less clunky (and more general) solution, having to disable form processing in the link and then do manually some parts of the processing seems quite involved (and each time I have to guess what's the right incantation, so at least having a set of steps, even if long would be an improvement). *quote from Wicket in Action (Which I heartily recommend if you haven't read it yet.) Yep, read it. Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ajax-y interactions inside a form
Well I'm not too familiar with this area of Wicket, but there's also AjaxLink "which is similar to Link, but sends a request using Ajax"*. Which means it doesn't submit like AjaxSubmitLink does. Linda *quote from Wicket in Action (Which I heartily recommend if you haven't read it yet.) Andrea Aime wrote: Linda van der Pal ha scritto: Have you tried adding an AjaxFormComponentUpdatingBehavior? Something like this: dropdown.add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(final AjaxRequestTarget target) { target.addComponent(textfield); } }); I did not actually, I also need to ask the user if he really wants to overwrite the contents of the textarea before going, something which I attached to the link. My problem is also more general, I have plenty of forms in which I'd like a more desktop-ish behaviour and this general problem tends to pop up in many variations depending on the form, so I'm looking either for a better understanding or for a more elegant solution (e.g. in other forms I have lists to be filled with whatever the user types in a text field, or palette components to be modified based on the contents of another component in the form, and so on). Cheers Andrea No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.392 / Virus Database: 270.13.23/2254 - Release Date: 07/22/09 05:59:00 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ajax-y interactions inside a form
Linda van der Pal ha scritto: Have you tried adding an AjaxFormComponentUpdatingBehavior? Something like this: dropdown.add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(final AjaxRequestTarget target) { target.addComponent(textfield); } }); I did not actually, I also need to ask the user if he really wants to overwrite the contents of the textarea before going, something which I attached to the link. My problem is also more general, I have plenty of forms in which I'd like a more desktop-ish behaviour and this general problem tends to pop up in many variations depending on the form, so I'm looking either for a better understanding or for a more elegant solution (e.g. in other forms I have lists to be filled with whatever the user types in a text field, or palette components to be modified based on the contents of another component in the form, and so on). Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ajax-y interactions inside a form
Have you tried adding an AjaxFormComponentUpdatingBehavior? Something like this: dropdown.add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(final AjaxRequestTarget target) { target.addComponent(textfield); } }); Linda Andrea Aime wrote: Hi, I'm having quite a headache figuring out a clean way to make a form that behaves like a desktop app. Basically I have a dropdown that allows to choose some template, and ajax link that should populate the contents of a text area based on what you chose in the dropdown (content that can be retrieved only at the server side). Making it work when there are other components that need validation in the same form is sort of a nighmare (or more likely, lack of understanding of how things work): - if the link is a plain link, the onClick is always triggered, but the form components are not updated (so I don't get to know what's inside the drop down) - if I use a AjaxSubmitLink it does work, but only if the form as a whole is valid. Not what I want - if I disable the normal form processing in the ajax submit link the onSubmit is triggered even if the form is not valid, but then I have to validated by hand the components in order to be able and grab what the user selected (using getConvertedInput) I've attached a sample application that does what I want, but it's not exactly elegant... on the contrary, it seems quite convoluted and I got there mostly by trial and error... is there a better way? Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.392 / Virus Database: 270.13.23/2254 - Release Date: 07/22/09 05:59:00 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org