Adding javascript to my NewForm.aspx page


  • Hi, I am trying to add the following to my form in order to provide a link for the user to open my infopath xml document.  This works on a regular content editor web part but I keep receiving javascrip errors when I try to do it in my new form.

    //added this part beneath my <<SharePoint:ListFormPageTitle runat="server"/> tag

    <script type="text/javascript">
         function NewRequest()
            createNewDocumentWithRedirect('https:\u002f\\u002fsites\u002fdddddcom\u002fProdOps\u002fvendormgmt\u002fVendor Mgmt Requests\u002fForms\u002ftemplate.xsn', 'https:\u002f\\u002fsites\u002fdddddcom\u002fProdOps\u002fvendormgmt\u002fVendor Mgmt Requests', 'SharePoint.OpenXmlDocuments.2', true, '', 0)

    //added this part beneath my webPartZone

     <A title="" href="javascript:NewRequest();" target="">Click here to initiate a new Vendor Requests</A>

    The error is the listed below

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8; .NET4.0C)
    Timestamp: Thu, 17 Feb 2011 17:57:30 UTC

    Message: Object expected
    Line: 1
    Char: 1
    Code: 0
    URI: http://domainandthenFLists%2FProject%2520Request%2520Form%2FAllItems%2Easpx

    Any help or advice appreciated.

    Leland Usher SharePoint Developer/Administrator
    • Edited by Leland Usher Thursday, February 24, 2011 4:53 PM
    Thursday, February 17, 2011 6:20 PM


All replies