Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Open PDF from List Control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Open PDF from List Control

    Hi All,

    I'm trying to open a PDF from a list control by clicking on a button within the list. One of the list fields named 'DigitalLocation' contains the path to the PDF.
    The button contains an action javascript with the "'Open an .a5w page, static HTML page, URL, or PDF document, in a pop-up windows or DIV" action.

    If I hardcode a path to a PDF file it works as expected. However, if I try to assign the a field placeholder for the 'DigitalLocation' field, it won't work. I've tried adding the following to the PDF filename property of the action javascript...
    1. {listElement:DigitalLocation}
    2. {listElementContainer:DigitalLocation}
    3. {list::lstDocuments::DigitalLocation}

    for first and second just return a blank screen, the third complains of a bad address.

    As always, any assistance would be appreciated.

  • #2
    Re: Open PDF from List Control

    Jim,

    Yes, I ran into the same problem trying to open files from a List component. I did find a workaround which is the only method I could get to work.
    Have a look at the thread here ... http://www.alphasoftware.com/alphafo...List-Component

    Hope it helps,
    Stephen
    Last edited by iRadiate; 06-22-2016, 04:56 PM. Reason: typo
    Alpha Anywhere v12.4.6.3.0 Build 7582-5569 IIS v10.0 on Windows Server 2019 Std in Hyper-V

    Comment


    • #3
      Re: Open PDF from List Control

      This is how I do it. Not sure if it is easier.

      I have the return value of the list set to 'field' using the pdf filename field.

      I have created a hyperlink with the 'Add Item' that uses a field from the list for the hyperlink text.

      in the onClick of the hyperlink I have action javascript to open a pdf which used the lists name ({list1}) as the pdf filename.

      It seems like it would work from a button too.

      It works for me.
      2016-06-22_23-12-42.png
      2016-06-22_23-18-36.png
      2016-06-22_23-20-32.png
      2016-06-22_23-23-24.png
      Last edited by frankbicknell; 06-22-2016, 11:24 PM.
      Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

      Comment


      • #4
        Re: Open PDF from List Control

        Hi Jim,

        try this method :
        1. create a textbox control and hide it (eg: textbox1)
        2. add a button on your list field, onclick -> get document_link column value -> var city = {dialog.object}.getValue('list::LIST1::City'), then set your hidden textbox value with document_link value.
        3. then create a action javascript, html container->open a5w,pdf, use {textbox1} as the pdf filename
        4. add that javascript action javascript after set value.

        So your button onclick will have this steps:
        a. getvalue from active row on your list
        b. set textbox1 value with 'a' value
        c. run javascript action

        Comment


        • #5
          Re: Open PDF from List Control

          There are a couple of ways to do this without involving the creation of other controls and filling them, althoug there's nothing wrong with that.

          The first way involves creating a Custom Control in the List. Alpha creates the field server-side. A Custom Control wants you to complete a Definition. Here is the Definition I used. By default, Alpha gives you a HTML string tags to work with, but you don't have to use them. I'm creating a Custom Control named "fullPathPDF".
          Here I'm taking the 2 fields from my data, in the List... PDFPath (the relative path e.g. Documents) and ImageFileName (e.g. myDoc.pdf), and putting them together...

          Code:
          function fullPathPDF_render as c (ds as p, tmpl as p)
          'Specify the Xbasic that returns the HTML for this control. 
          'This function must return fullPathPDF_render, which should
          'contain the HTML that will be displayed.
          'The 'ds' argument that is passed in contains the current 
          'values for each of the fields in the current List row. 
          'For example: ds.data("Firstname")
          
          '-------------------------------------------------------------------
          on error goto fullPathPDF_xbasicError
          
          'Write Xbasic code here that returns the HTML to be displayed by this control
          fullPathPDF_render = ds.data("PDFPath") + "\\" + ds.data("ImageFileName")
          end
          fullPathPDF_xbasicError:
          fullPathPDF_render = "Error in custom control xbasic: " + error_text_get() 
          end function
          Then, in the Action Javascript, in the PDF filename property... {list::LISTCUST::fullPathPDF}

          The second method has the List returning an Expression instead of a Field or Primary Key... if you can live with that...

          In the List Return Value type, choose Expression.

          The Expression would be...
          data.PDFPath + '\\' + data.ImageFileName;
          There's a builder for this. By the way... those are 2 backslashes... not pipes. Not sure why the forum is saving them as pipes.

          And finally, in the Action Javascript, you can supply just the name of the List Control... because it's just like any other control... you just want it's value.

          Code:
          {LISTCUST}
          In both cases, ensure that the button you have defined in the List does NOT have Propagation checked. You need the click to propagate down and select the row you clicked on.

          Comment


          • #6
            Re: Open PDF from List Control

            Thanks for all the advice. I was able to retrieve the path to the PDF by setting the return value of the list to the path field (as per Frank), but I still can't get the PDF to open. It looks like the path is being altered to some html friendly format that it doesn't like. If I send in a path like M:\Docs\Test.pdf it converts it to M:/%5CDocs%5CTest.pdf, and the debug message from Chrome says Not allowed to load local resource: file:///M:/%5CDocs%5CTest.pdf. If I manually enter M:\Docs\Test.pdf into the PDF filename property it works. Is there some way I can prevent this conversion?

            I was just trying to use a hyperlink to the file but only IE would open it, Chrome and Firefox wouldn't so that's why I'm trying this way. But this way isn't working in any browser.

            Comment


            • #7
              Re: Open PDF from List Control

              Jim, I'd really suggest taking a look at my method if you haven't, it works!
              Stick a label or textbox on your UX (hide it if you want). Populate it with the file location. Use that value for the list file download. That simple.
              Alpha Anywhere v12.4.6.3.0 Build 7582-5569 IIS v10.0 on Windows Server 2019 Std in Hyper-V

              Comment


              • #8
                Re: Open PDF from List Control

                Hi Stephen,
                I did try your method as well. In fact, I have your method setup now modified to be visible and only accept manual input so I can try passing in a UNC path instead of the mapped drive path. But unfortunately I still get the conversion issue.

                Oh and I'm not trying to download a pdf, just trying to display it (although I guess in the end, they are very similar).

                Comment


                • #9
                  Re: Open PDF from List Control

                  Originally posted by CampnJim View Post
                  Hi Stephen,
                  I did try your method as well. In fact, I have your method setup now modified to be visible and only accept manual input so I can try passing in a UNC path instead of the mapped drive path. But unfortunately I still get the conversion issue.

                  Oh and I'm not trying to download a pdf, just trying to display it (although I guess in the end, they are very similar).
                  That's too bad. So the filename is incorrect in the UX control?

                  Yeah, download is a bit of a misnomer in the browser isn't it. The browser renders the pdf (I believe Chrome & Firefox have built-in pdf rendering, whereas IE requires the adobe reader plugin).

                  Here's how I have my File Download Action Javascript setup:

                  Ref_Filename.png

                  And if I make the control visible in the UX, the complete filepath is displayed correctly (as it is in the SQL database field)

                  Filepath.png
                  Last edited by iRadiate; 06-23-2016, 10:22 AM.
                  Alpha Anywhere v12.4.6.3.0 Build 7582-5569 IIS v10.0 on Windows Server 2019 Std in Hyper-V

                  Comment


                  • #10
                    Re: Open PDF from List Control

                    I have a feeling something else is going on with your UX that we don't know about... which is very often the case. If you post a working UX illustrating the issue then all the guesswork will not be needed.

                    Comment

                    Working...
                    X