You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Samppa Saarela <Sa...@cs.Helsinki.FI> on 2004/12/01 13:48:10 UTC

Re: Null error with NumberValidator

> Small world - I emailed the list a few days ago about the exact same
> problem. No answer yet...

I tried to search gmane and google but didn't find anything about the 
subject...

> > In practice this exception can be avoided by
> > setting the validators required property to true,
>
> This works? Won't the validator still throw an exception because the
> value is not filled in? And because it throws an exception,
> setIntValue(null) is called..
>
> I'd love to hear about workarounds for this problem, I'd rather not
> change all my primitive ints to Integers.

If the field is required, then the error (i.e. lack of required value) 
is handled by the validator and recorded to the delegate. Since the 
given value is invalid, it is not tried to be set, so the un-caught 
exception is avoided and the user can be show a friendlier required 
message "You must enter a value for IntField".

I guess what I expected is that setting zeroIsNull would also mean that 
nullIsZero.

Even more usefull would be some kind of nullValue -option that would 
enable to define a custom value for nulls - for example -1 is sometimes 
used to represent undefined.

-Samppa 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Component change recording

Posted by Nicholoz Koka Kiknadze <ki...@hotmail.com>.
Hello,

Think the problem I'm looking into is quite common for most newbie's and
there should be some 'correct' way of handling it.

I have object hierarchy mapped to component hierarchy presented on my page.
User updates any component and hits save to record changes to persistent
storage (database in my case). Now I need to know which objects in the
hierarchy have been actually changed not to issue redundant update
statements. Currently I just have persistent page property 'oldValue' and in
formSubmit listener I walk my 'newValue' object graph and compare each
object to the corresponding old values (brrr, had to implement 'equals' for
all of them).

Ideally I'd like to be able to set 'dirty' flag for each edited object in
the corresponding Component (and hopefully avoiding implementing equals()).
Or maybe there's some better approach?

Tya
Nicholoz Koka Kiknadze


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org