Welcome Guest Search | Active Topics | Sign In | Register

Uploader: Validating other controls on same page Options
Paul Creedy
Posted: Tuesday, May 13, 2008 4:55:27 AM
Rank: Advanced Member
Groups: Member

Joined: 6/5/2007
Posts: 76
I have a few text boxes plus the uploader.
I need to validate the text boxes using standard VS ValidationRequiredField controls.

It would seem that when using the uploader my other fields are not validated. It just goes straight ahead and uploads even when required fields are empty.

How do I validate other fields using standard Validation controls when using the uploader?

I realise the the page needs to be posted before validation can take please, but when I set autopostback =true it still doesn't validate.

How do you implement validation on other controls when using the uploader?
eo_support
Posted: Tuesday, May 13, 2008 10:08:22 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

The uploader itself does not trigger validation. Uploader is designed more as a "content control" that allows you to edit its contents (list of files) before you finally submit the result. In a way it is similar to a textbox control, you can edit the text and then use other control (for example, an asp:Button) to submit what the user entered, at which point validation is triggered by whichever control that triggers the postback. Uploader works the same way.

AutoPostBack is somewhat different. We do believe there are reasons to trigger validation when AutoPostBack is enabled because the uploader itself is triggering the postback. However there are also concerns because the postback raised by the uploader is not a result of an immediate direct user action (for example, clicking a button). Most users are fine when they see an error message right after an action of their own, but can be very confused when an error message appears to come out of blue by its own.

Thanks
Paul Creedy
Posted: Tuesday, May 13, 2008 10:39:56 AM
Rank: Advanced Member
Groups: Member

Joined: 6/5/2007
Posts: 76
I get your point about the user getting confused, but putting that asside I can't get the validation on other controls to work.

When the form posts back using autopostback the validation doesn't work. I gather I'm missing something here but can't put my finger on it.

eo_support
Posted: Tuesday, May 13, 2008 11:29:12 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Paul Creedy wrote:
When the form posts back using autopostback the validation doesn't work.


The point is validation needs to be triggered by somebody else other than the uploader (where you are still expecting the uploader, not other controls to trigger validation for you), regardless whether you use AutoPostBack or not. My previous post explained why it is implemented this way both when AutoPostBack is set and not set.

Try put a button in the form along side the uploader and you will see it triggers validation just fine.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.