On Mon, 13 Oct 2008, Matthias Keller wrote:
> AJAX is not an option, as it is client side.

Sorry, what do you mean exactly? Javax is server-side. But 
do you need a pure javascript solution?

> Another scenario would be: User has to enter some data which needs to be 
> stored in a certain way. For example a number needs leading zeros or 
> whatever, it would be good for a validator to a) check that the value is 
> a number and b) on the fly update the value with leading zeros as needed 
> - I guess a converter could do the job but I think that's overkill...?

Not at all, why? Having the validator do that would be very
strange.

add(new TextField("numberWithLeadingZeroes") {
    @Override
    protected IConverter getConverter() {
        return new ZeroPaddingConverter();
    }
});

Also remember that Form.process() does (you can easily
check this out in its source code)

1) convert raw input to converted input, or report error 
   if this fails

2) validate converted input and update model with it, or 
   report error if this fails

> A custom model also is not that easy, at least to my understanding as 
> the model values come from two different components......

Quite the contrary, I think that by explicitly fleshing out
your models the logic often comes a lot clearer (if more
verbose).

For example, you could have the model of the radio button
set the value chosen by the select box by
1) if the upper button is chosen, set directly the default
   value to your domain object
2) if the lower button is chosen, set the selected value
   (getModelObject() or getConvertedInput()) from the select
   box to your domain object

All this in IModel.setObject().

Without code this is a bit abstract, if you show code maybe
we can see where the code would go (I never remember how the
radio models go and I think that there are two ways to do
them anyway).

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to