XmlFormView data validation while executing save with JavaScript - InfoPath Dev
in

InfoPath Dev

XmlFormView data validation while executing save with JavaScript

Last post 01-06-2009 06:36 AM by Zeppelin. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 01-05-2009 11:40 AM

    XmlFormView data validation while executing save with JavaScript

    Hello, I have a custom web page with the XmlFormView control embedded and setup just fine. Everything works well. The problem I'm coming across is when I use the Toolbar.ExecuteAction('save', event) through javascript when the form is unloaded. When this is called, the form saves but saves even when there are data validation errors. Basically, it's not acting as though the user clicked the save/submit button on the InfoPath toolbar. Where, if there are errors, the user will get a popup message stating the problem. Any thoughts on this? Is there a way or object within XmlForm to look at in order to see the errors via javascript? Thanks.
  • 01-05-2009 09:44 PM In reply to

    Re: XmlFormView data validation while executing save with JavaScript

    Hi,

    Add the following code lines to verify the errors.

    var thisXDocument = null;

    thisXDocument = window.external.Window.XDocument;

    if (thisXDocument.Errors.Count > 0)

    {

    alert("Please fill the required fields.");

    return;

    }

    Else

    {

    Write your code here

    }

     

    Swathip
    www.ggktech.com
  • 01-06-2009 05:15 AM In reply to

    Re: XmlFormView data validation while executing save with JavaScript

    window.external.Window.XDocument gave me a null error, so I changed it to thisXDocument = window.external.XDocument. Next, I get an error that Errors is null or not an object. Any thoughts on the Errors collection being null?
  • 01-06-2009 05:26 AM In reply to

    Re: XmlFormView data validation while executing save with JavaScript

    Hi,
    Verify thisXDocument is null or not. If that is null then you will get the above mentioned error.

     

    Swathip
    www.ggktech.com
  • 01-06-2009 05:31 AM In reply to

    Re: XmlFormView data validation while executing save with JavaScript

    thisXDocument turns out to be undefined.
  • 01-06-2009 05:40 AM In reply to

    Re: XmlFormView data validation while executing save with JavaScript

    Hi,
     Are you using 
    var thisXDocument = null;
    thisXDocument = window.external.Window.XDocument;

     

    Swathip
    www.ggktech.com
  • 01-06-2009 05:48 AM In reply to

    Re: XmlFormView data validation while executing save with JavaScript

    Hello, I have the following: var XDocument = null; XDocument = window.external.Window.XDocument; With this code, I get the message that window.external.Window.XDocument is null or not an object
  • 01-06-2009 06:03 AM In reply to

    Re: XmlFormView data validation while executing save with JavaScript

    Hi

    Can you check once the 'Microsoft.Office.Interop.InfoPath.SemiTrust' namespace is added or not?

     

     

    Madhuri
    http://www.ggktech.com
  • 01-06-2009 06:36 AM In reply to

    Re: XmlFormView data validation while executing save with JavaScript

    Doesn't look like it. I registered the namespace at the top of the aspx page. But that didn't do anything different. Maybe I did it differently and incorrectly. Do you know of some examples I can view? Links? Thanks for the help!
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.