<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Browser Forms</title><link>https://www.infopathdev.com:443/forums/40.aspx</link><description>For browser form specific questions</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Custom ASPX hosted browser form and validation error</title><link>https://www.infopathdev.com:443/forums/thread/32548.aspx</link><pubDate>Thu, 25 Sep 2008 20:50:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:32548</guid><dc:creator>saiyan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/32548.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=32548</wfw:commentRss><description>Hi all.&lt;br /&gt;
&lt;br /&gt;
I am currently developing a browser enabled Infopath form to be hosted ona custom ASPX page using XmlFormView control.&lt;br /&gt;
However, I have run into a weird problem related to data validation error.&lt;br /&gt;
&lt;br /&gt;
Here are some basic info about the form I am working on.&lt;br /&gt;
&lt;br /&gt;
The form in question has four views.&lt;br /&gt;
View 1 through 3 each has a button called &amp;quot;Next&amp;quot; and page 4 has a regular submit button.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Next&amp;quot; buttons on view 1 through 3 each run the following rules:&lt;br /&gt;
1) Execute a data connection to submit for data (but it&amp;#39;s not a Submit button so no OnSubmit even is triggered).&lt;br /&gt;
2) Switch to the next view (e.g. swithc from view 1 to view 2, or view 2 to view 3, etc).&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Submit&amp;quot; button on view 4 simply runs the submit data connection and close the form.&lt;br /&gt;
&lt;br /&gt;
(The reason I execute submit data connection for each view is so the users will not lose their data entry if they decided to close the form and come back later).&lt;br /&gt;
&lt;br /&gt;
The form&amp;#39;s main data connection has a field called &amp;quot;currentView&amp;quot; which is used to store the name of the current view displayed.&lt;br /&gt;
The value of &amp;quot;currentView&amp;quot; defaults to the name of View 1 and is also updated by FormEvents_ViewSwitched event handler in VB to record the value of CurrentView.ViewInfo.Name.&lt;br /&gt;
&lt;br /&gt;
The value &amp;quot;currentView&amp;quot; is used by various data validation rules I added to the form so only the current view will be validated when I click on &amp;quot;Next&amp;quot; button.&lt;br /&gt;
Basically input fields which need to be validated all have rules that checks for&lt;br /&gt;
1) the currentView name&lt;br /&gt;
AND&lt;br /&gt;
2) the validation criteria (e.g. is the field blank)&lt;br /&gt;
&lt;br /&gt;
The form was originally developed to use a data connection which submits to a specific SharePoint library directly and everything (including data validation) worked just fine.&lt;br /&gt;
&lt;br /&gt;
However, after I changed that data connection to &amp;quot;SubmitToHost&amp;quot; and use XmlFormView in a custom ASPX to host the form, I will get data validation error when I click on the &amp;quot;Next&amp;quot; button.
The error message indicates that fields belong to the next view do not pass validation.&lt;br /&gt;
&lt;br /&gt;
To make sure &amp;quot;currentView&amp;quot; field is updated properly I added dummy expression boxes in each view to display the value of &amp;quot;currentView&amp;quot; and remove the submit connection testing.  And I have confirmed that &amp;quot;currentView&amp;quot; is updated properly by the FormEvents_ViewSwitched event handler when &amp;quot;Next&amp;quot; button is clicked.&lt;br /&gt;
&lt;br /&gt;
So it seems to me that when the form is hosted in a custom ASPX page, data validation after a submit does NOT occur until after switch view rule is executed.&lt;br /&gt;
&lt;br /&gt;
Does anyone know what I may be doing wrong here?&lt;br /&gt;
Or is there a solution to this problem.&lt;br /&gt;
&lt;br /&gt;
My current work-around is to remove all data validation rules and use expresion boxes with conditional formating to display error messages for data validation and do the actual validation in VB after &amp;quot;Next&amp;quot; button is clicked.&lt;br /&gt;
&lt;br /&gt;
Thanks.</description></item></channel></rss>