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

return javascript from xbasic in a5w page.

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

    return javascript from xbasic in a5w page.

    It seems like this should be easy but I just can't figure it out. Any help will be much appreciated.

    What I am trying to accomplish is I have a list that has a dynamic image that when clicked opens an a5w page to view a pdf document (I have reasons for doing it this way).
    The problem I am having is I want to change the page title to something meaningful. I have tried adding javascript to the page but it seems that you cannot have xbasic and javascript together in one a5w page. If i remove the xbasic code the javascript runs ok. as soon as I add the <%a5w %> tags no javascript.
    I am hoping that I can return some javascript from the xbasic code similar to the way a callback returns javascript.
    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/

    #2
    Re: return javascript from xbasic in a5w page.

    This may sound silly....but you aren't adding the javascript in between the %a5w and the %> are you? It should be in the html but not in between the a5 tags. Also, it will need to be normal html/javascript convention I believe. I have some javascript running in an a5 page and it looks like this:

    Code:
    <%a5
    Xbasic code..............
    %>
    <script>
      document.getElementById('Userid').focus();
    </script>

    Comment


      #3
      Re: return javascript from xbasic in a5w page.

      Code:
      <%a5w
      if file.exists(PdfFileName) then
      response.mime_type = "application/pdf"
      ?file.to_blob(PdfFileName)
      else
      response.redirect("noPdf.a5w")
      end if 
      %>
      
      <script type="text/javascript">
      document.title = "Hello World";
      alert('hello');
      </script>
      This is the code I have. The javascript does not run unless I remove the a5 tags and code. I am not getting any errors. I'm puzzled.
      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: return javascript from xbasic in a5w page.

        Whoops, I missed that you were trying to return something.

        To display something on the page within your Xbasic code you MAY be able to do this:

        Code:
        ?<script>document.getElementById('Userid').focus();</script>
        I have a line that puts a session variable on the screen so they know who is logged in:

        Code:
        ?"You are currently logged in as: <b>" + session.user + "</b> "
        That works for sure.

        Comment


          #5
          Re: return javascript from xbasic in a5w page.

          Ah,
          I think your quotes are screwing things up. Try this:
          Code:
          ?"<script type=""text/javascript"">document.title = ""Hello World"";alert('hello');</script>"
          I don't bother with giving it a script type and just use <script></script> so I wasn't having the problem....UNTIL I put that in and noticed the quotes.

          Using single quotes within your double quotes instead of more double quotes will probably work too:

          Code:
          ?"<script type='text/javascript'>document.title = 'Hello World';alert('hello');</script>"

          Comment


            #6
            Re: return javascript from xbasic in a5w page.

            Frank, the very beginning of your code you have <%a5w ...should only be <%a5

            I tried this code (see below) in live preview and i got the alert message.

            Code:
            <%a5 
            dim a as n = 1
            
            if a = 1 then
            	'do something
            else
            	'do something else
            end if
            %>
            
            <script type="text/javascript">
            document.title = "Hello World";
            alert('hello');
            </script>
            Mike Brown - Contact Me
            Programmatic Technologies, LLC
            Programmatic-Technologies.com
            Independent Developer & Consultant​​

            Comment


              #7
              Re: return javascript from xbasic in a5w page.

              You are setting the MIME type to indicate that you will be displaying a PDF, then sending the PDF content. You cannot include JavaScript then because the PDF viewer is going to handle the response and doesn't know what to do with it.

              Lenny Forziati
              Vice President, Internet Products and Technical Services
              Alpha Software Corporation

              Comment


                #8
                Re: return javascript from xbasic in a5w page.

                Thanks everyone. I had a typo in the code box I know its <%a5. It looks like I'm going to have to go to plan b.... hmmm just what is that...
                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


                  #9
                  Re: return javascript from xbasic in a5w page.

                  Originally posted by frankbicknell View Post
                  Code:
                  <%a5w
                  if file.exists(PdfFileName) then
                  response.mime_type = "application/pdf"
                  ?file.to_blob(PdfFileName)
                  else
                  response.redirect("noPdf.a5w")
                  end if 
                  %>
                  
                  <script type="text/javascript">
                  document.title = "Hello World";
                  alert('hello');
                  </script>

                  This is the code I have. The javascript does not run unless I remove the a5 tags and code. I am not getting any errors. I'm puzzled.
                  even if you were to remove the w from the top, the javascript is separate from the xbasic there is no connection nothing to return.

                  on the other hand try a simple a5w page with this code
                  Code:
                  <%a5 ?Date()
                  dim msg as c
                  msg = "<script>"
                  msg = msg + "alert('frank, this is working');"
                  msg = msg + "</script>"
                  ?msg
                  
                   %>
                  <p><h1> Hello Frank </h1></p>
                  it will popup a message.
                  since javascript is nothing but characters you can print or send it to the browser just like any other character string.

                  place this in between body tags and run the a5w page
                  Last edited by GGandhi; June 19, 2015, 06:59 PM.
                  thanks for reading

                  gandhi

                  version 11 3381 - 4096
                  mysql backend
                  http://www.alphawebprogramming.blogspot.com
                  [email protected]
                  Skype:[email protected]
                  1 914 924 5171

                  Comment


                    #10
                    Re: return javascript from xbasic in a5w page.

                    Thanks for the response Govindan but it still does not work. As soon as I remove the response.mime_type line it all works. So it it exactly as Lenny said. I will have to rethink this whole thing. I can't even remember why I thought I had to open the pdf files this way. I think I tried it with a ux and open a pdf action java script but it could not find the files. I have the filename stored in a field and I am passing that value to the a5w page and it opens fine.
                    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


                      #11
                      Re: return javascript from xbasic in a5w page.

                      I am trying an alternative way to display a pdf. I would like to try using action javascript. Does any know the syntax for entering a lists field value in the pdf fileaname property? for a grid or a ux it is simply {field_name} I have tried all of the combinations of names I can think of but I am not getting anywhere
                      2015-06-22_11-59-55.png
                      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


                        #12
                        Re: return javascript from xbasic in a5w page.

                        Does {list::NAME_OF_LIST::NAME_OF_FIELD} work?
                        Alpha Anywhere latest pre-release

                        Comment


                          #13
                          Re: return javascript from xbasic in a5w page.

                          When I use that I get a page that indicates that the address was not understood in firefox. I don't know how to see what alpha is sending. The filename field stores the full path and file name. Alpha must be adding http: instead of file: I guess.

                          It seems that I can't use the drive letter in this method of opening a pdf. It works fine when it is passed as a parameter to an a5w page. I'm not sure of what the difference is.
                          Last edited by frankbicknell; June 22, 2015, 05:07 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


                            #14
                            Re: return javascript from xbasic in a5w page.

                            set the list return value to the field that contains the full path spec of the pdf
                            create an action in the onclick event of the list to open a pdf in a window and specify for example that a file "c:\scratch\test.pdf" must be opened
                            verify that it works
                            now pass in the parameter 'this' in the runaction method
                            edit the action & convert to text
                            replace the literal pdf file name with objEle.value
                            done

                            see this video: http://screencast.com/t/SueeL1QQ

                            edit: attached sample component (make sure you have a pdf file "test.pdf" in c:\scratch or chage the list data for the component to work test.a5wcmp
                            Last edited by Clipper87; June 22, 2015, 07:30 PM.
                            Frank

                            Tell me and I'll forget; show me and I may remember; involve me and I'll understand

                            Comment


                              #15
                              Re: return javascript from xbasic in a5w page.

                              Thank you for the detailed example. That has shown me how I can see more of whats going on behind the scenes.
                              I still cannot get this thing to work. There is something wrong with the open pdf dialog or the way I am trying using it is not allowed.
                              I tried using and following your sample but I get the same results.
                              Just to be clear my list returns the primary key, the filename is in a field in the list. I am opening the pdf from a dynamic image added to the field list.

                              If I hard code the filename with path eg c:\folderone\foldertwo\file.pdf in the pdf filename property field of the action javascript - open a web page or pdf file dialog. When running live preview with IE the pdf opens fine. With firefox I get an error indication that it does not like the (c) in the file path. On the server ie opens a window but the pdf never loads, firefox reports the same error.
                              The open pdf dialog is doing something to the filename because if I take that same field and pass it as a parameter to an a5w page that opens the pdf with the file to blob method it works fine in both ie and firefox.
                              Maybe it has something to do with having so many lists on one page.

                              I have wasted so much time on something that should be simple. I have to move on to other things. Alpha has wore me out on this one. (at least 10,000^100 mouse clicks)
                              All is not lost I can still open the pdfs I just wish I could have a meaningful title when using the a5w page method.

                              2015-06-22_21-36-56.png2015-06-22_21-37-33.png2015-06-22_21-38-25.png
                              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

                              Working...
                              X