Send page's link to a Sharepoint library with Javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jalley06
    New Member
    • Mar 2008
    • 20

    Send page's link to a Sharepoint library with Javascript

    This may not be possible but here goes:

    I have an Expense Report (aspx page) created in Sharepoint Designer 2007 and after the user fills in the report with data, I want them to be able to click a Save or Submit button and have the URL of that page be sent to a Link Library I have setup in Sharepoint using the JavaScript onclick method. Is this possible?

    An alternative would be clicking on that same button and instead of sending a link to a SharePoint library, saving the page as a jpeg or PDF and uploading it to the Sharepoint directory all in one whack, though I fear that may be a little more involved (both on my side and the user's side).

    Thanks for all the help.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Not too familiar with Sharepoint. Would it be like a server-side? If so, you could use location.href and add the current location.href as a query parameter.

    Comment

    • jalley06
      New Member
      • Mar 2008
      • 20

      #3
      Originally posted by acoder
      Not too familiar with Sharepoint. Would it be like a server-side? If so, you could use location.href and add the current location.href as a query parameter.
      It would be server side yes...could you explain more?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        For example:
        [CODE=javascript]location.href = "sharepoint.asp x?link=" + encodeURICompon ent(location.hr ef);[/CODE]

        Comment

        • jalley06
          New Member
          • Mar 2008
          • 20

          #5
          Originally posted by acoder
          For example:
          [CODE=javascript]location.href = "sharepoint.asp x?link=" + encodeURICompon ent(location.hr ef);[/CODE]
          What about the latter part of my question? Would that be possible?

          Basically I want to save the page with a filename that is automatically generated (by concatenating the username field and the report id field) and uploading it to my Sharepoint server by clicking once on a button.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            You can't save the page on the client-side unless you use browser-specific code, e.g. execCommand("sa veas") in IE.

            Why not do all this on the server-side? Take the input and generate the image/pdf on the server.

            Comment

            • jalley06
              New Member
              • Mar 2008
              • 20

              #7
              Originally posted by acoder
              You can't save the page on the client-side unless you use browser-specific code, e.g. execCommand("sa veas") in IE.

              Why not do all this on the server-side? Take the input and generate the image/pdf on the server.
              Ok, I'm game. How do I go about doing that?

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Originally posted by jalley06
                Ok, I'm game. How do I go about doing that?
                I'm afraid I can't help you much on that one. I know there are a number of server-side languages that can do that, but I'm not sure what you're using. If it's .NET-related, ask in the .NET forum.

                Comment

                Working...