Well the model doesn't update. (Not that I'd expect it to.)

Here's some pieces of my code I deem relevant to the problem.


if (key == null || key.getIsbn() == null) {
   book = new Book();
} else {
   book = bookRetriever.getBook(key.getIsbn(), key.getCollectionId());
}
setDefaultModel(new CompoundPropertyModel<Book>(book));

// ...

isbnField.add(new AjaxFormComponentUpdatingBehavior("onchange") {
   private static final long serialVersionUID = 1L;

   @Override
   protected void onUpdate(final AjaxRequestTarget target) {
       try {
           book = bookRetriever.getBook(isbnField.getInput());
           modelChanged();
target.addComponent(titleField);
           //...
           target.addComponent(genrefield);
       } catch (SQLException e) {
           //...
       }
   }
});

John Krasnay wrote:
Sounds like you're on the right track. What's the problem?

jk

On Wed, Aug 12, 2009 at 04:27:41PM +0200, Linda van der Pal wrote:
I have a panel with a form. This form has several fields, one of which is the ISBN of a book. The fields are filled by a CompoundPropertyModel if the user is editing his previous entry, and they are empty if the user is adding a new book. Simply entering data or updating it and then submitting already works. But now I want to fetch the data for the other fields if the ISBN is already in the database. It is a multi-user system, so it is in fact possible that the ISBN is already in there.

I was thinking of achieving this with AJAX, but I'm not really sure how to do it. I was thinking of adding an AjaxFormComponentUpdatingBeavior, where all the related fields are added to the target. But as the ISBN is part of the model, I don't really now how to get this working. Any hints on what direction I should be searching in?

Regards,
Linda

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
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.53/2299 - Release Date: 08/12/09 18:12:00



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to