onValidate() gets called for every form component inside your form. The NullPointerException you are
getting is likely due to some other form component also validating. Change the method name to match
your upload component's id, e.g. onValidateFromUpload() if your component's id is upload. That
should do the trick. onValidateForm() can be used to do validation across multiple fields and isn't
meant to do validation for just one field.
Uli
On 14.08.2009 11:55 schrieb Stephan Windmüller:
Hello!
We are using the upload component of tapestry and want to validate the
content type during the upload. To accomplish this we wrote the
following code:
| @Property
| private UploadedFile file;
|
| [...]
|
| void onValidate() {
|
| if(file.getContentType().toLowerCase(Locale.ENGLISH)
| .equals("application/pdf")) {
| [...]
| }
| }
To our surprise, the field "file" is always null during the validation,
but not in onSuccess.
Is it not possible to validate this? Or do we have to put a manual
validation in onSuccess?
TIA
Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org