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

Set Submit Button to New Window

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

  • Set Submit Button to New Window

    I have a lot of reports and all of them are opening to the current page. I really need them all to open in a new window.

    Where would I set this up in a grid or dialog?

    Would I use the following code?

    window.open('url to open','window name','attribute1,attribute2')
    Up and coming Alphaholic ;)

  • #2
    Re: Set Submit Button to New Window

    In a grid or dialog link field type you can set the target to open in a new page. So what I have done is open (in a new window) an A5W page that is pure code, and that page opens the PDF report.

    Or, on the same page that has the dialog that runs the report, I have placed code like this to cause a hyperlink to appear below the dialog after the Submit is pressed. The link then opens the report in a new window. You can make this more fancy by individually naming the reports, and listing them as they are created. Since this model has the reports going to the session folder, they all disappear when the user's session times out.

    Code:
    if file.exists(session.session_folder + "tempreport.pdf")
    	pdfurl = session.session_url + "tempreport.pdf"
    	?"<a href=\"" + pdfurl + "\"target=\"_blank\">--> Click here to open lastest report in new window</a>"
    	else
    	?"After you press Submit, a link to your report will appear here."
    end if
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

    Comment


    • #3
      Re: Set Submit Button to New Window

      I've tried this several ways but it just won't work like you have above. Where can I put the information in to make this print to another page?

      Dim filename as c
      filename = session.session_folder + "tempreport.pdf"
      filename = report.saveas("production-wo@[PathAlias.ADB_Path]\workorder set.set","pdf",filter,order,filename,.f.)
      if file.exists(filename)
      currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
      end if
      Up and coming Alphaholic ;)

      Comment


      • #4
        Re: Set Submit Button to New Window

        Hi Elena,

        You don't do it in the code, you need to "target" the page that has your code, to open in a new window.

        A long time ago, Alpha answered that there is no way to open a new window with a redirect. So the two options I know how to use are:

        1) Like my example below, it creates a hyperlink to the report on the same page as the dialog, tells the user to click to open the report. Not very flashy and the user may wonder why they have to click twice to get their report.

        2) Take your code almost as is and move it to a new A5W page. Change the currentform.redirecttarget and change it to response.redirect() function. Then on your dialog, add a LINK field that opens your new page with the code. On the Link field, you can set it to open a new window, or even use Javascript to open a new window of specific size.

        I know there must be one more way - the Submit button on the dialog is after all a Button. So it must be possible to add Javascript to the onclick function of that button to cause the result (the report) to open in a new window. I just don't know how to do it.

        ----

        For anyone reading, the primary reason to do this is that users tend to click the X to close a report after they are done viewing. If the report opens in the SAME window and they close the window, they have just closed the entire application and have to find their way back to the program, back to the page they were on just before they ran the report.
        Steve Wood
        Join the ALPHA DEVELOPERS NETWORK
        There is no Cloud. It's just someone else's computer.
        Web - Mobile - Hosting - Products - Frameworks - Developer Resources
        AlphaToGo | IADN (100% Alpha Anywhere Websites)

        Comment


        • #5
          Re: Set Submit Button to New Window

          You are absolutely right. The reports are opening up inside the application which is a pain for the client because they have to use the 'back' button to get back to the main page for the website.

          I guess I'm going to hunt through the javascript website to see if there's a solution there. I need to update at least 10 pages. Those 2 suggestions may work for a few of my pages but the majority will need something more seamless.

          What I'd really like to do is open them in another tab but that's undoable according to the javascript boards I've read so far.
          Up and coming Alphaholic ;)

          Comment


          • #6
            Re: Set Submit Button to New Window

            Now I've messed it up somehow. It will print the reports inside the component but it won't print on the a5w page. dang! Can anyone see anything that would cause it not to work on the web page?

            I've taken one of the web forms and manipulated it so that I can choose either the client job number or the internal job number instead of different reports. I've got nearly the same setup on another page and it's working fine. The change was that contactlist is a text box instead of drop down.



            jobno = alltrim(CurrentForm.Controls.ContactList) (text box)
            mtjobno = alltrim(CurrentForm.Controls.ContactList) (text box)
            report = alltrim(CurrentForm.Controls.ReportList) (drop down)

            if CurrentForm.Controls.ContactType = "1" then
            dim filter as c
            dim order as c
            Filter = "Clientjobn = \""+jobno+"\""
            Order = ""
            Dim filename as c
            filename = session.session_folder + "tempreport.pdf"
            filename = report.saveas(report,"pdf",filter,order,filename,.f.)
            if file.exists(filename)
            currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
            end if
            else
            IF eval_valid("mtjobno") = .f. Then
            goto skipreport
            end if
            dim filter as c
            dim order as c
            Filter = "(Newjobno = "+mtjobno+" )"
            Order = ""
            Dim filename as c
            filename = session.session_folder + "tempreport.pdf"
            filename = report.saveas(report,"pdf",filter,order,filename,.f.)
            if file.exists(filename)
            currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
            end if
            skipreport:
            end if
            Up and coming Alphaholic ;)

            Comment


            • #7
              Re: Set Submit Button to New Window

              Confused - is this code below what you placed on an A5W page? Won't work there you know.
              Steve Wood
              Join the ALPHA DEVELOPERS NETWORK
              There is no Cloud. It's just someone else's computer.
              Web - Mobile - Hosting - Products - Frameworks - Developer Resources
              AlphaToGo | IADN (100% Alpha Anywhere Websites)

              Comment


              • #8
                Re: Set Submit Button to New Window

                No. This code is on a dialog. I just inserted the component on an a5w page.


                http://www.mailtimenet.com

                user: alphauser
                pass: temp123

                go to reports / print single or multiple work orders

                Update: I've tried different set ups as well. It works fine when I do a live preview inside of the component. It's after I put it on the web that it doesn't work. It doesn't work with localhost either.
                Last edited by eboughey1; 02-19-2009, 11:50 AM.
                Up and coming Alphaholic ;)

                Comment


                • #9
                  Re: Set Submit Button to New Window

                  Maybe this will help. It is an example of one approach Steve has suggested:

                  Screen1 shows a grid with a link to the reports dialog.

                  Screen2 shows the setup. Notice the "New Window" property

                  Screen3 shows the print dialog

                  The AfterValidate for the dialog (in part ) is:

                  Code:
                   
                  Dim vFilter as C
                  Dim vOrder as C
                  Dim vEv_Id as C
                  Dim filename as C
                  vEvId = alltrim(CurrentForm.Controls.vEvent.value)
                  vR_Type = alltrim(CurrentForm.Controls.vReport.value)
                  If vR_Type ="PR" '==== Pre-registration report
                   vFilter="su2pe->Ev_Id = "+s_quote(vEvId)
                   vOrder="su2pe->AT_LNAME+su2pe->AT_FNAME"
                   filename = session.session_folder + chr(92) + "prreport.pdf"
                   filename = report.saveas("[EMAIL="Signups@[PathAlias.ADB_Path]\Su_Set.set%22,%22pdf%22,vFilter,vOrder,filename,.f"]Signups@[PathAlias.ADB_Path]\Su_Set.set","pdf",vFilter,vOrder,filename,.f[/EMAIL].)
                   if file.exists(filename)
                    currentform.RedirectTarget = session.session_url + "prreport.pdf?" + time("hms3")
                   end if 
                  end if
                  If vR_Type ="CI" '==== Check-In report
                   vFilter="Su2Pe->Ev_Id = "+s_quote(vEvId)
                   vOrder="su2pe->AT_LNAME+su2pe->AT_FNAME"
                   filename = session.session_folder + chr(92) + "cireport.pdf"
                   filename = report.saveas("[EMAIL="Check_In@[PathAlias.ADB_Path]\Su_Set.set%22,%22pdf%22,vFilter,vOrder,filename,.f"]Check_In@[PathAlias.ADB_Path]\Su_Set.set","pdf",vFilter,vOrder,filename,.f[/EMAIL].)
                   if file.exists(filename)
                    currentform.RedirectTarget = session.session_url + "cireport.pdf?" + time("hms3")
                   end if 
                  end if
                  If vR_Type ="RR" '==== RU Receipts
                  .
                  .
                  .
                  In this case, when they close the report, it goes back to the grid.

                  Pat
                  Pat Bremkamp
                  MindKicks Consulting

                  Comment


                  • #10
                    Re: Set Submit Button to New Window

                    Hi,
                    I'm desparately trying to do nearly the same thing. I've given up on trying to print a report to a frame on my existing page from the dialog button. I was hoping Steve's solution might work, but no.

                    The code appears to be creating the PDF (it's in the session folder) but it is never displayed, nor is the the link that is supposed to be created.

                    Below is the code I've tried:

                    dim filter as c
                    dim order as c
                    Filter = ".T."
                    Order = ""
                    Dim filename as c
                    filename = session.session_folder + "tempreport.pdf"
                    filename = report.saveas("RNE_Report@[PathAlias.ADB_Path]\req_competitors.set","pdf",filter,order,filename,.f.)
                    'if file.exists(filename)
                    if file.exists(session.session_folder + "tempreport.pdf")
                    pdfurl = session.session_url + "tempreport.pdf"
                    ?"<a href=\"" + pdfurl + "\"target=\"_blank\">Click here to open the report in new window</a>"
                    else
                    ?"After you press the button, a link to your report will appear here."
                    end if


                    I would love to hear if anyone has been able to get this to work.

                    Please help me before I go crazy . . . . .
                    Land of the Free, Because of the Brave
                    Support our US Military

                    Comment


                    • #11
                      Re: Set Submit Button to New Window

                      Is there a way to open a new window/specify a target for the results of a dialogue that specifies a filter expression to pass on to a page? The dialogue creates a filter expression that is passed to the new page in the after validate event:
                      Code:
                      Currentform.RedirectTarget = "Grid_list_4.a5w?Grid_list_4_filter=" + filter
                      .
                      I have the dialogue in a frame and want to open the resulting grid in another frame, not the same frame.
                      Richard Urban

                      Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

                      Comment

                      Working...
                      X