onvalidate

S

steve

I have a whole bunch of VB code in the OnValidate routine for a field.
This code captures data entry errors and displays messages to the
user. That's fine, but now i realize the user can still attempt to
save the form anyway if they don't change the value (since the
OnValidate is only triggered when a change is made). At that point
they would get the standard InfoPath error message which indicate a
field has a validation error, which is sure to confuse the users.

I could copy all the validation code into the Submit button routine,
but that's pretty ugly. i guess i could create a module with the code
and call it from OnValidate and Submit. Still seems wrong.

There must be a "normal" way of handling this situation (obviously i
don't do this everyday). Any suggestions?

thanks
 
G

Greg Collins

What I've often done is to have the submit function just check to see if
there are *any* validation errors (using the Errors collection) and if so,
give a generic message to go handle those, and cancel out. If no errors,
then proceed with the submit.
 

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

Top