Validator misery

P

Pete Hearn

Hi All

Just got my first ASP.net form running - a proud moment! The form has about
20 fields, and a few need to have values supplied. No problem - shoved in a
few RequiredFieldValidators and all was well.

After reviewing what I'd done, I decided to change the submit button from
being a link button to a regular button.

No problem thinks I - just hook up the previous button's event handler to
the new button and away we go. Except we didn't go anywhere. The
validators still appeared to work, but once all validations were satisfied,
the form was still not submitted.

Stripped off all the validators and the form is submitted fine (albeit that
no validation is performed). Add back a single validator and I'm stuck
again - i.e. it correctly spots and empty field, but even if you fill that
field the form is never submitted. Delete the validator so the form has
none and the form is submitted just fine.

I'm so disappointed , but hoping that this might be a well known newbie
error.

Any thoughts anyone?

TIA,
Peter
 
W

Weston Weems

What version of the .net framework. Also does ff produce different results
from ie?

Are all these imput type="text"?

Also, what are you performing on the button click event, to make it apparent
that the form submission is occuring properly?

Its not entirely out of the question that the asp.net validators are just
broke. They've got real erratic clientscript behavior in anything but ie.

Also if you are on .net 1.1 sp1, there are conditions like that where the
webuivalidation.js is off, and you need to re-copy an appropriate version.

Weston
 
P

Pete Hearn

Hi Weston - thank for responding.

Running .Net 1.1 with latest patches. Controls are TextBoxes, DropDownList
and CheckBox. Only using the RequiredFieldValidator. Worked fine
yesterday - having changed the submit button and nothing else, it's all
crashed and burned.

Based on what you're saying, the Validators are not very stable technology.
Perhaps I should just validate it all on postback.

Does ASP.Net 2 have improvements in this area?

Regards,
Peter
 
R

RCS

fwiw - if you use SmartNavigation (e.g. you have SmartNavigation="true" on
the @page directvie) - that seems to consistently mess up the validators -
or if you have multiple validators on one page. SmartNavigation works really
well on small/simple pages - but if you have more than a couple things going
on - it messes up lots of things.

hth
 
P

Pete Hearn

certainly had multiple validators on a page but it did work at the time -
now it doesn't. Sounds like the technology is a bit flaky - I'll wait for
ASP.Net 2.0!!

Thanks for your input RCS - much appreciated!
 
P

Pete Hearn

Just in case anyone's interested, the solution is:

stop IIS
run aspnet_regiis -ea // this deletes the existing javascript libraries
run aspnet_regiis -c // this re-creates the scripts from scratch
start IIS // you're done

Hope this might help anyone else who's validators stop the postback from
happening
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top