0

Is there a way to set the target attribute to post form data to using Apache Royale? We are attempting to minimize the impact on migrating from Flex to Royale with the Flash Player retirement. I can't use a BrowserWindow("URL", target) because this would be more complicated with our older applications that use HTMLframes.

HTTPService will allow us to post our form data to a url but it defaults the "target" attribute to "_blank". In the code below we are using HTTPService to send our data to a URL for processing and display.

How do I direct a form post into a target frame or is there a way to Override the private variable target that is set to "_blank"?

            var urlVars:URLVariables = new URLVariables();
            urlVars.set("EMPID", "8675309");                
            urlVars.set("FORM[NAME]", "Software, User");
            
            // create the httpservice instance
            var service:HTTPService = new HTTPService();
            service.url = "https://info-test.company.com/DaveTest.cfm";
            service.method = HTTPConstants.POST;
            
            service.addEventListener("complete", completeHandler);
            
            // add the variables
            service.contentData = urlVars;
            
            // trigger the service
            service.send();

1 Answers1

0

BrowserWindow is specific to opening a new window. It sounds like you need an iframe. The HTML package has an Iframe component, but that's new to 0.9.8 which has not yet been released.

You can also use <js:WebBrowser/> which uses an iframe under the hood

Communication between iframes can only be done with postMessage.

Something like this:

 window["top"]["postMessage"]("foo", '*');
 if (window.parent != window["top"]) {
   window.parent["postMessage"]("foo", '*');
 }

If you want to send the actual result of the POST, you should be able to do that by adding the “transferrable":

https://developer.mozilla.org/en-US/docs/Web/API/Transferable

Harbs
  • 106
  • 5