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: [email protected]
For additional commands, e-mail: [email protected]
------------------------------------------------------------------------


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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to