Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / June 2005

Tip: Looking for answers? Try searching our database.

How can verify if the InfoPath form is valid before saving it.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
G. Tarazi - 13 Dec 2004 15:42 GMT
Hi

I have created an event handler to capture the save button, and redirect it to save using custom code.

When I try to save an invalid document, I have a dialog box that is warning me that some of the values are not valid, this is nice, but the problem is that this box has a yes and no buttons

"This form contains validation errors, errors are marked with wither a red asterisk (required fields) or a red, dashed border (invalid values)."

And if the user presses yes, the form will save the invalid values

The question is how I can find out if there are any invalid values in the form before saving. (Marked invalid by the InfoPath validation itself)

Thanks
G. Tarazi - 13 Dec 2004 19:13 GMT
fiund this one too :-)

XDocument.Errors.Count > 0

 Hi

 I have created an event handler to capture the save button, and redirect it to save using custom code.

 When I try to save an invalid document, I have a dialog box that is warning me that some of the values are not valid, this is nice, but the problem is that this box has a yes and no buttons

 "This form contains validation errors, errors are marked with wither a red asterisk (required fields) or a red, dashed border (invalid values)."

 And if the user presses yes, the form will save the invalid values

 The question is how I can find out if there are any invalid values in the form before saving. (Marked invalid by the InfoPath validation itself)

 Thanks
Nick - 09 May 2005 17:14 GMT
Im sure by now you have the answer, but for anyone else who has this question:

thisXDocument.Errors.Count > 0, then you have errors.

> fiund this one too :-)
>
[quoted text clipped - 13 lines]
>
>   Thanks
Nick - 28 Jun 2005 21:47 GMT
Ok, here is my problem with this:

Before the custom save handler is envoked, this Yes / No dialog box
described below is invoked.  I need to learn how to avoid this.  We have a
scenario where the form overall may have errors, but we only care about
certain views which are applicable only under certain conditions.  So
basically, is there any way to turn off this validation warning which shows
up prior to the actual save handler?

> Im sure by now you have the answer, but for anyone else who has this question:
>
[quoted text clipped - 17 lines]
> >
> >   Thanks
Alex [MSFT] - 29 Jun 2005 07:16 GMT
Simply modify all your validation expressions to include another variable:

(your expression) AND doCheck = 1

Then, when in your Save handler, set doCheck to 1 - this will cause all
validations to happen.

Good luck,
Alex @ Microsoft

> Ok, here is my problem with this:
>
[quoted text clipped - 35 lines]
>> >
>> >   Thanks
Nick - 29 Jun 2005 16:05 GMT
Alex-

This will not work.  As I had stated, the problem lies in the fact that
Yes/No happens BEFORE the save handler.  I need to find a way to disable this
message, then use whatever code I need in the handler.

Thanks,
Nick

> Simply modify all your validation expressions to include another variable:
>
[quoted text clipped - 45 lines]
> >> >
> >> >   Thanks
Alex [MSFT] - 30 Jun 2005 19:37 GMT
Create a button on the bottom of the form that allows the users to save the
form. This button will set doCheck = 1 and then look at
XDocument.Errors.Count. If it is = 0, it will call XDocument.Save().

Good luck.
Alex

> Alex-
>
[quoted text clipped - 61 lines]
>> >> >
>> >> >   Thanks

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.