Problem with HTML passing variables to AMS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Squirrel22
    Forum Member
    • Apr 2003
    • 6

    Problem with HTML passing variables to AMS

    I'm using this rutine into AMS to identify which link in a HTML embedded in a AMS page was clicked:

    nPos = String.ReverseFind(e_URL,"#",true);
    if nPos then
    strPage = String.Mid(e_URL, nPos+1, -1);
    Page.Jump (strPage);
    end

    Basically the link in the HTML has this format:

    <a href= "#Menu1" target ="_top">

    And the rutine above search for the "#" to find the name of the page to jump. The rutine works OK, but preverves the name of the last page clicked on the HTML and when I click in buttons designed in AMS they don't obey anymore and only jumps to the last page selected by the HTML.

    Hope I was enough clear, english is not my language..hehehe.

    Any advice? Thanks in advance.
  • Desmond
    Indigo Rose Staff Member
    • Jul 2003
    • 710

    #2
    Hello,

    Any time a link is clicked within the web object, the On Navigate action is fired, and the e_URL variable is filled in with whatever information is most current (in this case, the URL you are navigating to, I believe).

    If you want to use a different value within you ams project, you'll have to store it outside of the e_URL variable (for example, in a variable stored_URL).

    Does that answer your question?

    Comment

    • Corey
      Indigo Rose Staff Alumni
      • Aug 2002
      • 9745

      #3
      Hi, yes I've run into that before it's a bit of a bug in AMS. To workaround that just jump to any blank HTML page and then back to your original one, that clears the variable and the URL. Hope that helps. :yes

      Comment

      • Squirrel22
        Forum Member
        • Apr 2003
        • 6

        #4
        Thx Desmond, but Corey got my point most.

        And I agree, to point to an empty HTML is a workaround, but isn't elegant. Is there a way to clear the content of the variable and the URL in a script?

        I'm using the HTML to run a DHTML menu for all my pages (near 10), so the AMS project has 100 pages. The HTML does not fill the screen, I left a row to display the AMS buttons to navigate back to the main page. The first page has a big SWF which calls the next 2 pages. The HTML lets me to navigate between AMS pages and HTML docs. The "bug" confuses the logical navigation between these pages and the HTML docs.

        Comment

        • Corey
          Indigo Rose Staff Alumni
          • Aug 2002
          • 9745

          #5
          I just use the page jump workaround, I tried a couple others and it turned out to be the reliable way. :yes

          Comment

          • Worm
            Indigo Rose Customer
            • Jul 2002
            • 3971

            #6
            In the pages On Close event, use Web.LoadURL to load the base htm page into your web object again. It still allows your page to navigate, but also sets the web object back to the base page.

            Comment

            • Corey
              Indigo Rose Staff Alumni
              • Aug 2002
              • 9745

              #7
              Are you sure that resets any anchor links in the URL? Seems to me I tried that and found the page jump was the only reliable way to do it right. I might be wrong though...

              Comment

              • Worm
                Indigo Rose Customer
                • Jul 2002
                • 3971

                #8
                I guess I'm not understanding what supposed to happen.

                Comment

                • Corey
                  Indigo Rose Staff Alumni
                  • Aug 2002
                  • 9745

                  #9
                  Lets say you have a web object. And inside that is an HTML page named "index.html" which contains a menu. The links in the menu look like this:

                  index.html#home
                  index.html#video
                  index.html#products
                  index.html#cart
                  index.html#contact

                  So the goal is that by parsing e_URL for just that bit that's to the right of "#" you can have the host AMS app respond to clicks from within your HTML just as it would to any normal button or object link.

                  That's the situation. The problem arises in that when you reload/refresh index.html the anchor link and e_URL do not reset themselves as they should, or something to that effect. At any rate there's a wrinkle in there somehow where you end up checking for an empty value but you get the "last used" value, or something to that effect. I tried tons of ways around it, I think Brett said it was related to IE ActiveX when I asked him, at any rate the only solution I ended up with which worked 100% was to create a second page with a 0 second refresh back to index.html, i.e. "refresh.html" and forward to that with each link. That's how the first Speedy CD menu is done, possibly the second too, I can't recall for sure.

                  Anyhow hope that shines some light on the scenario.

                  Comment

                  • Worm
                    Indigo Rose Customer
                    • Jul 2002
                    • 3971

                    #10
                    Alright, I see, and I have run into the same issue (I think).

                    For me it came down to this. The Web Object holds the last URL you navigated to. That means when you come back to the page, the Web Object's On Navigate event fires with the last URL you were on. Which in this case would fire a Page.Jump

                    I've worked around that by navigating the Web Object back to the base HTML file (i.e. index.html) in the page's On Close event. There is no # in the URL then and therefore, no page jump.

                    Comment

                    • Corey
                      Indigo Rose Staff Alumni
                      • Aug 2002
                      • 9745

                      #11
                      In this case though you want to stay on the same AMS page, but just respond to the anchor link and then reset the URL as well as the e_URL value. For example in my Speedy menu the project is only one page long and the html links are just used to launch videos. Anyhow I can't remember all the details but eventually I found that the refresh.html HTML page jump workaround was the ticket. Your solution is good too though. :yes

                      Comment

                      • Squirrel22
                        Forum Member
                        • Apr 2003
                        • 6

                        #12
                        I didn´t expect this kind of support! Thanks guys! The zero refresh HTML seems a good solution, also, I´ll try Web.LoadURL solution. :yes

                        Comment

                        • Corey
                          Indigo Rose Staff Alumni
                          • Aug 2002
                          • 9745

                          #13
                          I didn´t expect this kind of support! Thanks guys!
                          No problem.

                          Comment

                          Working...
                          X