Error relating to a custom Save event handler - InfoPath Dev
in

InfoPath Dev

Error relating to a custom Save event handler

Last post 10-06-2009 09:04 PM by Kumaran Pandourangan. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-05-2009 04:02 AM

    Error relating to a custom Save event handler

    Hi All, I'm using Infopath '03. I'm trying to disable my Save and Save As commands, when a field named "Current_Status" equals "Review Complete" using VBScript.

     

    Here is my code so far...

    Sub XDocument_OnSaveRequest(eventObj)

      If XDocument.DOM.selectSingleNode("my:myFields/my:Current_Status").Text = "Review Complete" Then

        XDocument.UI.Alert("Sorry you can't save this document as it is read-only!")

        eventObj.ReturnStatus = False

        Exit Sub

      Else

        eventObj.IsCancelled = eventObj.PerformSaveOperation

        eventObj.ReturnStatus = True

      End If

    End Sub   

     

    When i test it my alert box comes up fine, but then another alert box follows which states "Infopath cannot save this form. The OnSaveRequest handler returned a value indicating that the save failed". Can i change my code to get rid of this alert???

    Hopefully that made sense, you'll have to excuse me I'm quite new to Infopath. Cheers

     

     

  • 10-06-2009 09:04 PM In reply to

    Re: Error relating to a custom Save event handler

    Hi

    In order to avoid the error message, do the following

    1. Double-click the submit button to go to the properties.

    2. Go to "General" tab and click on "Submit Options" and then click on "Advanced" 

    3. Click to clear the "Show success and failure message" checkbox.

    You should now see only your error message and not the Infopath error message.

     Regards

    Kumaran

     

     

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