????? ????? ?????? ?? ????? InfoPath ???? ????

?????? ????????? ?????? ?????????
???? ???????: 896451 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ???? ??? ?????? ???????? ?? ????? Microsoft Office InfoPath ???? ????. ????? ??????? ????? OnLoad ????? ???? InfoPath ExternalApplication ?? ????? ???? ????? ASP. ??? ????? ????? ????????? ????????.

????? ???

???? ??? ??????? ????? ????? ?????? ?? ????? InfoPath Office ???? ????.

??????? ????

????? InfoPath ??? XML. ????? ????? ??? ???????? ?? ??????? ?XML ?????? ????????? ???? ???? ?????? Microsoft Windows ?? Microsoft Internet Explorer ???? ????? ????? ??????? ?????? XML.

????? ???? ???? ????? ???????? ??? InfoPath ???????? ???? ????? ??????? ???????:
  • ??????? ????? OnLoad.

    ?? ????? OnLoad ????? ??????? ??? ???? ASP ?? ???? ?????? ????? ??? ???????? ???????? ? ??? ??? ???????.
  • ????? ???? InfoPath ExternalApplication.

    ??? ??????? ?????? ????? ???? ????? ??? ???????? ?? ???? ?????.
    ?????? ??? ????? ??????? ????? ? ????? ?????? ActiveX ???? ?? ??? ??? ????? ??? ??? ???????? ?? Internet Explorer ??? ?????? ?? ????? ???? ??????? ?????.
    ??? ?? ???? ???????? ?? ???? ????? XML InfoPath ????.
  • ????? ???? ????? ASP.

    ????? ???? ASP ?????? XML ?? ??????? ?????? ?? InfoPath ???? ???? ?????. ????? ?????? XML ??? ???? ??? ???? ????? InfoPath ??? ??? ??? ????????. ???? ?? InfoPath ??? ???????? ??? ???? ?????.

????? ???? ????? ????

  1. ????? ????? ??????? ???????? Microsoft ?????.
  2. ?? ?????? ?????? ????? ??? ?? ????? ????? ??????.
  3. ???? ??? ?????? ?????? ??? ???? ??? ??? ???? ????? ???? ????? ???? ? ??? ??? ???? ?? ???? ??? ?????? ???????.
  4. ???? ??????? ???????? "????? ?????? ???????" ????? ????? ???? ????? ????.

    ?????? ??? ??? ??? ??????? ??? ?????? ???????.

????? ????? InfoPath

InfoPath 2007

  1. ??? ????? Infopath. ?? ????? ??????? ???? ??? ????? "???? ?????".
  2. ??? ????? ???? ? ???? ?????? ?????? ???? ????? ???? ??? ????? ???? ???? ?? ???? ??? ?????.
  3. ??? ???? ??????? ? ???? ??? ????? ??????.
  4. ???? ??? ???? ?? ????? ?????? ?? ????? ?????? ???? ??? ???????.
  5. ?? ???? ???????.
  6. ?? ??????? ???? ???? ??? ???.
  7. ?? "????? ?????" ? ???? ??? ??????. ???? ??? ??? ???? ??? ???? ????? ?? ???? ??? ??????.
  8. ?? ??? ????? ??????? ???? ??????? ?????? ???? URL ?????? ??????? ???? ??? ????????.
  9. ?? ?????? ??? ???? ??????? ???? twofield.xsn.

    ?????? ???? ?? ?? URL ??? ???:
    http:// myServer / /twofield.xsn myVirtualDirectory
  10. ???? ??? ?????? ? ???? ??? ??? ?? ???? ??? ?????.
  11. ????? InfoPath.

InfoPath 2003

  1. ??? ????? Infopath. ?? ????? ??????? ???? ??? ????? ?????.
  2. ??? ????? ????? ???? ??? ????? ???? ????.
  3. ??? ???? ??????? ? ???? ??? ????? ??????.
  4. ???? ??? ???? ?? ????? ?????? ?? ????? ?????? ???? ??? ???????.
  5. ?? ??????? ???? ???? ??? ???.
  6. ?? "????? ?????" ? ???? ??? ?????? ???? ??? ?????? "??? ???" ?? ???? ??? ??????.
  7. ?? ?????? URL ??? ???? ????? ? ???? URL ?????? ??????? ???? ??? ????????.
  8. ?? ?????? ??? ??????? ???? twofield.xsn.

    ?????? ???? ?? ?? URL ??? ???:
    http:// myServer / /twofield.xsn myVirtualDirectory
  9. ???? ??? ?????? ? ???? ??? ????? ?? ???? ??? ?????.
  10. ????? InfoPath.

????? ???? Default.asp

  1. ???? ??? ???? ?? ???? ??? ????? ????? ??????? ?? ???? ??? ?????.
  2. ?? ???? ???????? ???????? ??????? ?? ??? Notepad.
    <%@ Language=VBScript %>
    
    <%
    
      dim serverName, hrefPath, fileNamePos, serverPath
    
      serverName = Request.ServerVariables("SERVER_NAME")
    
      hrefPath = Request.ServerVariables("PATH_INFO")
    
      fileNamePos = InStr( 1, hrefPath, "/Default.asp", 1 )
    
      hrefPath = Left(hrefPath, fileNamePos )
    
      serverPath = "http://" + serverName + hrefPath
    
    %>
    
    <HTML>
    
    <head>
    
    <SCRIPT LANGUAGE=VBScript>
    
    Sub ButtonClick()
    
     Dim oInfoPathApp
    
     set oInfoPathApp = CreateObject("InfoPath.ExternalApplication")
    
     oInfoPathApp.New "<%=serverPath%>GetData.asp?dataRequest=2"
    
     set oInfoPathApp = Nothing
    
     window.close
    
    End Sub
    
    </SCRIPT>
    
    </HEAD>
    
    <BODY onload="ButtonClick">
    
    </BODY>
    
    </HTML>
  3. ?? ???? ????? ???? Default.asp. ??? ????? ?? ?????? ??????? ???? ??? ??????? ?? ??? "????? ???? ????? ????".

????? ???? ASP ?????? ????? ???? ????

  1. ??? ???? ??? ?? ???? ????? ??????? ??? ??????? Twofield.xsn ???? ??? ??????.
    ?????? ??? ??? ????? ???? ???? ??????.
  2. ???? ??? ??? ?? ???? ??? ??? ????.
  3. ?? ???? ????? ???? Form1.xml.
  4. ???? ??? ???? ?? ???? ??? ????? ????? ??????? ?? ???? ??? ?????.
  5. Paste the following code in Notepad.
    <%@ Language=VBScript %>
    <%
      ' Define the XML namespace for the form.
      Dim strNamespace
      strNamespace = "http://schemas.microsoft.com/office/infopath/2003/myXSD/2003-04-21T15:25:26"
     
      'Calculate the path of this server directory.
      dim serverName, hrefPath, fileNamePos, serverPath
      serverName = Request.ServerVariables("SERVER_NAME")
      hrefPath = Request.ServerVariables("PATH_INFO")
      fileNamePos = InStr( 1, hrefPath, "/GetData.asp", 1 )
      hrefPath = Left(hrefPath, fileNamePos )
      serverPath = "http://" + serverName + hrefPath
     
      ' Set our return content type.
      Response.ContentType = "text/xml"
    
      'Create an XML document to return.
      Dim oXML
      Set oXML = Server.CreateObject("MSXML.DOMDocument")
     
      'Create the XML header that all XML documents must have.
      dim myPI1
      set myPI1 = oXML.createProcessingInstruction("xml", "version=""1.0"" encoding=""UTF-8""")
      oXML.insertBefore myPI1, oXML.childNodes.item(0)
     
      'Create the mso-infopathSolution processing instruction that binds the XML from this page to the 
      'TwoField.xsn InfoPath form template.
      dim myPI2
      set myPI2 = oXML.createProcessingInstruction("mso-infoPathSolution", "solutionVersion=""1.0.0.1"" productVersion=""11.0.5531"" PIVersion=""1.0.0.0"" href=""" + serverPath + "TwoField.xsn""")
      oXML.insertBefore myPI2, oXML.childNodes.item(1)
     
      'Create the mso-application processing instruction that marks the XML from this page as an InfoPath form.
      dim myPI3
      set myPI3 = oXML.createProcessingInstruction("mso-application", "progid=""InfoPath.Document""")
      oXML.insertBefore myPI3, oXML.childNodes.item(2)
     
      'Generate the XML for the form.
      dim myFields
      set myFields = oXML.createNode( 1, "myFields", strNamespace )
      oXML.appendChild myFields
     
      dim field1
      set field1 = oXML.createNode( 1, "field1", strNamespace )
     
      dim field2
      set field2 = oXML.createNode( 1, "field2", strNamespace )
     
      dim requestedData
      requestedData = Request("dataRequest")
      Select Case requestedData
         Case "1"
            field1.text = "test field 1"
            field2.text = "test field 2"
         Case "2"
            field1.text = "test field 3"
            field2.text = "test field 4"
         Case "3"
            field1.text = "test field 5"
            field2.text = "test field 6"
         Case Else
            field1.text = "test field 7"
            field2.text = "test field 8"
      end Select
     
      myFields.appendChild field1
      myFields.appendChild field2
     
      'Return the XML to the client.
      Response.Write oXML.XML
    %>
    
  6. ?? ??????? ???? ???? ??? ??? ???? ???? GetData.asp ?? ?????? ??? ????? ??? ?? ???? ??? ???.
  7. ??? ????? ???? ???? ?? ???????.
  8. ?? ??????? ???? ???? ??? ??? ???? ??? Form1.xml ?? ???? ??? ???.
  9. ??? ???? xmlns: ????? ????? ????? ?? ????? ?? Form1.xml ? ?? ?? ???? ?????? ?????? ??.

    ?????? ?????? ??? ???:
    http://schemas.microsoft.com/office/infopath/2003/myXSD/2003-04-21T15:25:26
  10. ?? ??? GetData.asp ??? ???? ????? ??????:
    strNamespace = "http://schemas.microsoft.com/office/infopath/2003/myXSD/2003-04-21T15:25:26"
  11. ??????? ???? ????? strNamespace ?????? ???? ??? ?????? ?? ?????? ??? 9.
  12. ???? ??? ??? ?? ?? ?????? "???????".
  13. ??? ??? GetData.asp ??? ??? ?????? ??????? ??? ??? ??? ???? ??????? Twofield.xsn.

????? ??? ??? ????? InfoPath ???????? ????? ???????? ?? ???? ASP

  1. ??? ????? InfoPath.
  2. ?? InfoPath 2007? ???? ??? ????? ????? ???? ?? ????? ??????. ?? InfoPath 2003? ???? ??? ????? ????? ?? ????? ??????.
  3. ?? InfoPath 2007? ???? ??? ??? ???? ????????? ??? ??? ???? ?????. ?? InfoPath 2003? ???? ??? ??? ???? ????????? ??? ??? ????? ?? ??? ??????? ?? ??? ?????? ????? ?????.
  4. ???? URL ???? ??????? ???? ??? ??????.

    ?????? URL ??? ???:
    http://myServer/myVirtualDirectory/twofield.xsn
  5. ?? ??????? ?????? ???? ??? ??????? ?? ???? ??? ????? OnLoad.
  6. ??????? ??? ????? OnLoad ????????? ???????? ???????? ???????. ????
    function XDocument::OnLoad(eventObj)
    {
       //Only load data if the fields are empty.
       if (XDocument.DOM.selectSingleNode("/my:myFields/my:field1").text == "" )
       {
          //Work out the location of the data file based on the current install directory.
        searchExpression = new RegExp( "TwoField.xsn", "ig" );
        searchResults = XDocument.Solution.URI.match( searchExpression );
        if (searchResults.length == 0)
         return;
         
        //Clear the "TwoField.xsn" part of the string.
        var targetDirectory = XDocument.Solution.URI.slice(0, searchResults.index );
     
          //Load the example data into and XML document.
          var objExternalData = new ActiveXObject("MSXML2.DomDocument.5.0");
          objExternalData.async = false;
          objExternalData.validateOnParse = false;
          objExternalData.load( targetDirectory + "getData.asp?dataRequest=3" );
     
          //Set the SelectionNamespaces property so that we can search the example data.
          var strSelectionNamespaces = XDocument.DOM.getProperty("SelectionNamespaces");
          objExternalData.setProperty("SelectionNamespaces", strSelectionNamespaces );
     
          //Find the root node in the example data and import it into the InfoPath document.
          var objExternalXML = objExternalData.selectSingleNode("my:myFields");
          var objReplacementXML = XDocument.DOM.importNode( objExternalXML, true );
          
          //Find the original data in the form and replace it with the example data.
          var objOriginalXML = XDocument.DOM.selectSingleNode("my:myFields"); 
        XDocument.DOM.replaceChild( objReplacementXML, objOriginalXML );
     }
    }
    
  7. ?? ??????? ???? ???? ??? ??? ?????? ????? InfoPath.

?????? ????? InfoPath

????? ?????? ???????? ????? OnLoad

????? OnLoad ??????? TwoField.xsn ????? ???????? ?? ???? GetData.asp ??? ???? ?? ?????? ???? ?? ???????. ?????? ???????? ???? ??????? ???????:
  1. ???? ??? ???? ?? ???? ??? ????? ????? ???? ??????? ?? ???? ??? ?????. ?????? ???? ????? ??? ???:
    http:// myServer / /TwoField.xsn IPDynamicData
  2. ??? ??? ????? ???? ??? ???.
????? ???? InfoPath ?????? TwoField.xsn "???". ????? Field1 "?????? ????? 5" ? ?????? Field2 "?????? ????? 6". ??? ?? ????? ???? ???? GetData.asp ??? ????? ??????? dataRequest ????? ?? ??? "3".

????? ????? ??????? ???????? ExternalApplication.New

?????? ??? ?? ???? ?????? ?????? ?????? ExternalApplication ???? InfoPath ???? ?????? ???? Default.asp ?? ????? ????? ????. ????? ???? ????? ??? ?????? XML ???? ?? ??????? ?????? GetData.asp. ?????? ????? ???? ???? ??? ???? ?? ???? ??? ????? ? ????? ?????? ?????? Default.asp ?? ?? ???? ??? ?????. ?????? ???? ????? ??? ???:
http:// myServer / IPDynamicData / .asp default
?????? ???????? ??? ???????? ??? ???? ????? ??? ?????? ?? ????? ??????? ????? ? ????? ?????? ActiveX ???? ?? ??? ??? ????? ??? ??? ???????? ?? Internet Explorer.

????? ???? InfoPath ?????? TwoField.xsn "???". ????? Field1 "?????? ????? 3" ? Field2 ????? ???"?????? ????? 4". ??? ?? ????? ???? ???? GetData.asp ??? ????? ??????? dataRequest ????? ?? ??? "2".

????? ????? ????? ?? ???? ????? ASP

????? ???? GetData.asp XML ?? ??????? ?????? ?? InfoPath ???? ???? ?????. ?????? ????? ???? ??? ???? ?? ???? ??? ????? ? ????? ?????? ?????? GetData.asp ?? ?? ???? ??? ?????. ?????? ???? ????? ??? ???:
http:// myServer / /getData.asp?dataRequest=1 IPDynamicData
????? ???? InfoPath ?????? GetData.asp "???". ????? Field1 "?????? ????? 1" ?????? Field2 "?????? ????? 2". ??? ?? ????? ???? ???? GetData.asp ??? ????? ??????? dataRequest ????? ?? ??? "1".

???? Microsoft ??????? ???????? ??? ??? ?? ???? ??????? ?? ?? ?????. ??? ????? ???? ?? ????? ??? ???????? ??????? ?????? ???????? ?? ???????? ???? ????. ????? ??? ??????? ???? ?????? ?? ??? ??????? ???? ??? ????? ?? ??????? ???? ??? ????????? ?????? ?????? ?????????. ???? ??????? ????? ??? Microsoft ??? ????? ????? ???? ???? ?? ?????? ?????? ??? ??????? ?????? ????? ?????? ?? ????? ??????? ?????? ??????? ?????.

???????

???? ???????: 896451 - ????? ??? ??????: 08/???? ?????/1428 - ??????: 3.1
????? ???
  • Microsoft Office InfoPath 2007
  • Microsoft Office InfoPath 2003
  • Microsoft Office InfoPath 2003, Service Pack 1 (SP1)
????? ??????: 
kbmt kbscript kbasp kbhowto KB896451 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????896451

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com