Andrew Madu wrote: > Hi Simone, > many thanks for your suggestions. > >> 1) Instead of using redirectTo, set up a page with a link to the >> external site (like a jx page), then use sendPageAndWait to send this >> page to the user, he will click on the link, go to the external site >> and all the rest, while your flow will be suspended until the external >> site will redirect him to your continuation and the flow will restart. >> This is a clean solution, but involves one more step for the user. > > I have implemented the following so far: > > function getUserOrder() { > ...... > ...... > cocoon.sendPageAndWait("confirmStage") > }
It's not really related to the issue at hand, but instead of issuing a sendPageAndWait() to a pipeline that just calls another flow function, you could call that flow function confirmStage() directly and save some complexity. > > confirmStage is a sitemap function call: > > <map:match pattern="confirmStage.xml"> > <map:call function="confirmStage"/> > </map:match> > > > to: > > function confirmStage() { > //2. Get card details. > var form = new Form("forms/CreditCardDetails.xml"); > form.showForm("CreditCardDetails.xml", {"userGlobal":userGlobal}); > var model = form.getModel(); > var bizData = {"fname" : model.fname, "lname" : model.lname, > "account_no" : model.account_no, "credit" : model.credit, "month" : > model.month, "year" : model.year} > > try { > if (value-returned == true) { > }else{ > } > } catch (e) { > //Some problem has occured > msg2 = e.toString(); > } > } > > So I am making a sendPageAndWait to a form which reads like this in the > html: > > <form action="www.externalsite.com/test.asp > <http://www.externalsite.com/test.asp>" name="Form1" method="post" > onsubmit="forms_onsubmit(); "><input name="forms_submit_id" type="hidden" /> > <input value="32558c182c69426584288f333413213a8a2a6a58" type="hidden" > name="continuation-id" /> > ....... > > The user enters their credit card details and clicks submit which posts > the form to externalsite.com. > > Now, at this point, this is where I get confused. You say: > > *'while your flow will be suspended until the external site will > redirect him to your continuation'* > > How so? This is what comes back to me: > > www.mysite.com/continuation-id/value-returned > > What happens next? How do I get the *value-returned *into the if > statement following the var bizdata line? IIUC, you're just making an HTTP request to an external URL, passing it a few parameters, and getting back a one-line text result which you need to parse? You can do that all within flow by using the HTTPClient library: http://jakarta.apache.org/commons/httpclient/ (included with Cocoon). So instead of your form posting directly to the external site, have it post to your continuation like normal, then in your flowscript read the user's inputted values from the form, assemble them into a HTTPClient request, send that request to the external URL, and parse the response however you need to. Is this what you're wanting to do? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]