|
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?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
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
|
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
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.
|
|