Click to See Complete Forum and Search --> : Required Field Validation


spudmasher
08-08-2005, 01:56 AM
I've a web application that has a number of required fields, however the users must also be able to save the form when some of the required fields are missing.

I've been using the required field validators for the mandatory fields, but cant find the event that I can stop into to turn the "causes validation" property off so that the button can be clicked again and saved into the background.

Any ideas?

Thanks

Phil Weber
08-08-2005, 03:20 PM
If users can save the form when the fields are missing, then the fields aren't really required, are they? ;-)

See if this article helps: http://msdn.microsoft.com/msdnmag/issues/02/04/Valid/

Another option is to set the validators' EnableClientScript properties to False and perform all validation on the server. This way, you may choose to ignore individual validators.

spudmasher
08-08-2005, 04:57 PM
Thanks PHil

Yeah - that was my reasoning too, but its what is wanted! As the info is being captured from a handwritten form, the info must be typed in as is on the form - so if "ABC" is typed into a date field then the user must be informed that it is invalid, but "ABC" stored on the database! Likewise if a field is missing then it still should be saved. Needless to say when I mentioned that "ABC" couldnt be stored in a datetime field on SQL Server there was a bit of "harumph harumph harumph" - but thats all down to the design and another story.

So yeah, I do need the validation performed, but also bypassed on the second click of the button - looks like its going to happen individually - unless there is another method!

oupoi
08-09-2005, 01:19 AM
I believe that there are many approaches to do what you want.

The most straight forward is to do server side validation only as Phil said.

But rather than handling 2 separate events, validation and posting data, by the same button, the workflow seems to be clearer if there are 2 buttons.
One for validation which 'CauseValidation' is set to true, and the other for posting data which 'CauseValidation' is set to false. :WAVE: