Please note that these were just examples, not actual use cases of mine
(apart from the URL stuff).

Anyway, I think there are quite some use cases where fixing/optimizing user
input makes sense. I've always thought converters would be the way to go,
but just recently read that they aren't.

Having stuff like this done in the domain object's setter is far to backend
for my taste. As this feature addresses user interaction, I think it is
rather a matter of presentation, and I would not think that my domain object
should have to care. Worse, using this scenario it would not be possible to
use wicket's validation behavior _after_ doing the modification. One could
use a model as well, then.



kan-4 wrote:
> 
> As I remember, wicket trims spaces already, so you don't need do
> anything special about it.
> 
> For DB, if you use hibernate (or if not, anyway you should have data
> objects for your business entities), you can have something like that:
> public class MyEntity
> {
> // This is mapped to database, but not for public, only database will use
> it.
>   private String siteUrlStr;
> // this is your public interface:
>   public SiteUrl getSiteUrl(){return new SiteUrl(getSiteUrlStr());}
>   public void setSiteUrl(SiteUrl url){siteUrlStr = url.getStr();}
> }
> 
> And in code the lists should be treated as List, Collection or so, not
> as comma-separated strings (only in some particular places like
> persisting in database or in user interface).
> 
> 2008/12/11 pixologe <[email protected]>:
>>
>> Thanks for your ideas...
>>
>> But.... huh... is there really no "wicket way" to achieve this?
>>
>> After all I would not think that it is uncommon to fix simple things in
>> user
>> input before validation, e.g. trim strings, discard empty items in comma
>> separated lists etc.
>>
>> Your solutions would work both I think, I just do not like the idea of
>> doing
>> things like these with javascript.
>> Also, retrieving a String value from DB and wrapping it into an object
>> just
>> in order to be able to convert it back does not seem right to me...
>>
>> I'll probably stick to the js solution (reluctantly ;-), but if there is
>> really no elegant way, I would love to see one in future wicket versions.
>>
>> Thanks for inspiration!
>> best regards
>> --
>> View this message in context:
>> http://www.nabble.com/Modify-textfield-input-before-validation-tp20952903p20956050.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
> 
> 
> 
> -- 
> WBR, kan.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Modify-textfield-input-before-validation-tp20952903p20963023.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to