You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Edi <ed...@yahoo.com> on 2007/10/22 11:49:36 UTC

How to validate wicket FileUploadField?

Hello,

I have created one FileUploadField upload button. Support I do not select
any file, It should be validated. How?

I know fileuploadButtonName.setRequired(true);

But I did not get any validation messages. How can I add validation message
for FileUploadField button?

Thanking You

-- 
View this message in context: http://www.nabble.com/How-to-validate-wicket-FileUploadField--tf4669821.html#a13339893
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to validate wicket FileUploadField?

Posted by Bruno Borges <br...@gmail.com>.
I have this custom validator:

            fileUploadField.add(new IValidator() {
                public void validate(IValidatable validatable) {
                    String input = (String) validatable.getValue();
                    if (!luceneService.isSupportedFormat(input))
                        error(getString("LuceneFileNameValidator.invalidFile
"));
                }
            });

and it works fine.

For your situation, maybe you could ask to see if "input" is not null, and
if it is, add an error message.

Regards,
-- 
Bruno Borges
blog.brunoborges.com.br
+55 1185657739

"The glory of great men should always be
measured by the means they have used to
acquire it."
- Francois de La Rochefoucauld

On 10/22/07, Edi <ed...@yahoo.com> wrote:
>
>
> Hello,
>
> I have created one FileUploadField upload button. Support I do not select
> any file, It should be validated. How?
>
> I know fileuploadButtonName.setRequired(true);
>
> But I did not get any validation messages. How can I add validation
> message
> for FileUploadField button?
>
> Thanking You
>
> --
> View this message in context:
> http://www.nabble.com/How-to-validate-wicket-FileUploadField--tf4669821.html#a13339893
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>