Custom ASPX hosted browser form and validation error - InfoPath Dev
in

InfoPath Dev

Custom ASPX hosted browser form and validation error

Last post 09-25-2008 01:50 PM by saiyan. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 09-25-2008 01:50 PM

    • saiyan
    • Not Ranked
    • Joined on 04-25-2008
    • Posts 2

    Custom ASPX hosted browser form and validation error

    Hi all.

    I am currently developing a browser enabled Infopath form to be hosted ona custom ASPX page using XmlFormView control.
    However, I have run into a weird problem related to data validation error.

    Here are some basic info about the form I am working on.

    The form in question has four views.
    View 1 through 3 each has a button called "Next" and page 4 has a regular submit button.

    The "Next" buttons on view 1 through 3 each run the following rules:
    1) Execute a data connection to submit for data (but it's not a Submit button so no OnSubmit even is triggered).
    2) Switch to the next view (e.g. swithc from view 1 to view 2, or view 2 to view 3, etc).

    The "Submit" button on view 4 simply runs the submit data connection and close the form.

    (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).

    The form's main data connection has a field called "currentView" which is used to store the name of the current view displayed.
    The value of "currentView" 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.

    The value "currentView" is used by various data validation rules I added to the form so only the current view will be validated when I click on "Next" button.
    Basically input fields which need to be validated all have rules that checks for
    1) the currentView name
    AND
    2) the validation criteria (e.g. is the field blank)

    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.

    However, after I changed that data connection to "SubmitToHost" and use XmlFormView in a custom ASPX to host the form, I will get data validation error when I click on the "Next" button. The error message indicates that fields belong to the next view do not pass validation.

    To make sure "currentView" field is updated properly I added dummy expression boxes in each view to display the value of "currentView" and remove the submit connection testing. And I have confirmed that "currentView" is updated properly by the FormEvents_ViewSwitched event handler when "Next" button is clicked.

    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.

    Does anyone know what I may be doing wrong here?
    Or is there a solution to this problem.

    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 "Next" button is clicked.

    Thanks.
Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.