You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Roberts <dl...@ukonline.co.uk> on 2008/05/26 13:00:57 UTC
Parameterize Validation Errors
I would like to send back an error message like:
"There is an error with the uploaded file at line number #######"
for this I would like to do something like this in my custom validation
code:
String errorLineNumber = getErrors();
if (errorLineNumber != null){
csvForm.recordError(messages.get("myPackage.uploadError"),
errorLineNumber);
}
the .properties file would look like this:
uploadError=There is an error with the uploaded file at line number {0}.
--- Any ideas how I might do this?
thanks, David.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Parameterize Validation Errors
Posted by David Roberts <dl...@ukonline.co.uk>.
Thanks Filip - that's what I was looking for.
Filip S. Adamsen wrote:
> Btw, format uses the printf-format, so you'd use %d instead of {0}.
>
> -Filip
>
> Filip S. Adamsen skrev:
>> Hi,
>>
>> Try using format(String, Object...) instead of get(String). :)
>>
>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/ioc/Messages.html#format(java.lang.String,%20java.lang.Object...)
>>
>>
>> -Filip
>>
>> David Roberts skrev:
>>> I would like to send back an error message like:
>>>
>>> "There is an error with the uploaded file at line number #######"
>>>
>>> for this I would like to do something like this in my custom
>>> validation code:
>>>
>>> String errorLineNumber = getErrors();
>>> if (errorLineNumber != null){
>>> csvForm.recordError(messages.get("myPackage.uploadError"),
>>> errorLineNumber);
>>> }
>>>
>>> the .properties file would look like this:
>>>
>>> uploadError=There is an error with the uploaded file at line number
>>> {0}.
>>>
>>> --- Any ideas how I might do this?
>>>
>>> thanks, David.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Parameterize Validation Errors
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Btw, format uses the printf-format, so you'd use %d instead of {0}.
-Filip
Filip S. Adamsen skrev:
> Hi,
>
> Try using format(String, Object...) instead of get(String). :)
>
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/ioc/Messages.html#format(java.lang.String,%20java.lang.Object...)
>
>
> -Filip
>
> David Roberts skrev:
>> I would like to send back an error message like:
>>
>> "There is an error with the uploaded file at line number #######"
>>
>> for this I would like to do something like this in my custom
>> validation code:
>>
>> String errorLineNumber = getErrors();
>> if (errorLineNumber != null){
>> csvForm.recordError(messages.get("myPackage.uploadError"),
>> errorLineNumber);
>> }
>>
>> the .properties file would look like this:
>>
>> uploadError=There is an error with the uploaded file at line number {0}.
>>
>> --- Any ideas how I might do this?
>>
>> thanks, David.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Parameterize Validation Errors
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,
Try using format(String, Object...) instead of get(String). :)
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/ioc/Messages.html#format(java.lang.String,%20java.lang.Object...)
-Filip
David Roberts skrev:
> I would like to send back an error message like:
>
> "There is an error with the uploaded file at line number #######"
>
> for this I would like to do something like this in my custom validation
> code:
>
> String errorLineNumber = getErrors();
> if (errorLineNumber != null){
> csvForm.recordError(messages.get("myPackage.uploadError"),
> errorLineNumber);
> }
>
> the .properties file would look like this:
>
> uploadError=There is an error with the uploaded file at line number {0}.
>
> --- Any ideas how I might do this?
>
> thanks, David.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org