Open infopath form from sharepoint server - InfoPath Dev
in

InfoPath Dev

Open infopath form from sharepoint server

Last post 11-27-2009 06:07 PM by Patrick Halstead. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 11-23-2009 05:51 AM

    • Binay
    • Not Ranked
    • Joined on 11-09-2009
    • Posts 15

    Open infopath form from sharepoint server

    Hi All,

     I hace published my browser enable infopath form in Sharepoint.

    I have unchecked the Read only checkbox also.

    Now i am using folloing javascript code onclick of button which is in Asp.net page to open infopath form published in Sharepoint.

    1.  var oApp = new ActiveXObject("InfoPath.Application");

    2.  var oXDocumentCollection = oApp.XDocuments;

    3. var oXDocument = oXDocumentCollection.Open(http://SharepointSite/Infosite/Form.xsn);

    But the while debugging it gives the error  "
    InfoPath: InfoPath cannot open the following file:"http://localhost/Infosite/Form.xsn" The form is marked as read-only"

    The open Method takes two parameter as mentioned below.

    oXDocumentCollection.Open(URL,dwbehavior)

    If I give dwbehavior value as "8" it gives following error.

    "InfoPath: InfoPath cannot open the following file: http://sharepointsite.com/InfopathTest/Forms/AllItems.aspx.
    The file is not a valid XML file.
    ??
    The form contains XML that cannot be parsed:
    A name was started with an invalid character."

    Please Let me know if anyone know about the error.

     

    Some time if i change the path it does not give Read only error.but it gives following Error

    "InfoPath: InfoPath cannot open the following file: http://sharepointsite.com/InfopathTest/Forms/AllItems.aspx.
    The file is not a valid XML file.
    ??
    The form contains XML that cannot be parsed:
    A name was started with an invalid character."

  • 11-27-2009 04:00 AM In reply to

    Re: Open infopath form from sharepoint server

    Hi Binay,

    Is it read-only because you are debugging it on the server and using localhost? Debugging on the server may result in a more restrictive security policy.

    Best way to open a rich client form is described in Shiraz's blog:

    var strTemplateLocation_New = "http://sitename/folder/template.xsn";
    var strDefaultSaveLocation_New = "
    http://www.example.com";
    function CreateNewXMLDocument()
    {
        // Based on WPQ3combineDocuments()
        var objOpenXMLDoc = new ActiveXObject("SharePoint.OpenXMLDocuments.1");
        var bSuccess = false;
        bSuccess = objOpenXMLDoc.CreateNewDocument2(window , strTemplateLocation_New , strDefaultSaveLocation_New );
    }

    <a onclick="CreateNewXMLDocument(); return false;" style="cursor: pointer;" href="<numbersign>">Create New Blank Form</a>

    Best way to open in the browser is to use the following URL format:

    .xsn&OpenIn=Browser">http://<servername>/_layouts/formserver.aspx?XsnLocation=/FormServerTemplates/<template published>.xsn&OpenIn=Browser

    Where <servername> is the name of yoru server and <template published> is the name of your InfoPath template.

    Hope this helps!

    :)

    Patrick Halstead
    Project Manager at Qdabra
  • 11-27-2009 05:14 AM In reply to

    • Binay
    • Not Ranked
    • Joined on 11-09-2009
    • Posts 15

    Re: Open infopath form from sharepoint server

    Thanks Patrick for quick response.but it does not solved my problem.

    I am unable to fetch the infopath form controls through javascript.

    My requirement is as mentioned below

    1.I have created a browser enabled infopath form and published it to Sharepoint.

    2.Then i have created a HTML form and and inside iframe i have embedded the infopath form which is published in sharepoint.

    3.I have one button in html page outside iframe (where infopath form is embedded) not in Infopath form.

    4.Onclick of the button i need to fetch the value or control id of infopath form using javascript Without opening new infopath fom.

    Thanks

    Binay

     

  • 11-27-2009 06:07 PM In reply to

    Re: Open infopath form from sharepoint server

    Hi Binay,

    Sorry I misunderstood your scenario. We haven't done much work embedding InfoPath in a web-page. Sorry I cannot help you further.

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.