Sorry about the confusion and I appreciate your feedback . I would like to invoke the external URL as part of the onSubmit event. So before the form is submitted . So was looking for a way using AJAX and JavaScript to do it.
> On Jul 22, 2014, at 5:18 PM, Shahid <sshaikh1...@yahoo.com> wrote: > > Sorry about the confusion and I appreciate your feedback . > > I would like to invoke the external URL as part of the onSubmit event. So > before the form is submitted . So was looking for a way using AJAX and > JavaScript to do it > > Shahid Shaikh > >> On Jul 22, 2014, at 5:12 PM, "Thiago H de Paula Figueiredo [via Apache >> Tapestry Mailing List Archives]" <ml-node+s1045711n5727688...@n5.nabble.com> >> wrote: >> >> On Tue, 22 Jul 2014 13:38:48 -0300, Shahid Shaikh >> <[hidden email]> wrote: >> >> > Fellow Tapestry Users, >> >> Hi! >> >> > >> > I have a form that when submitted needs to >> > make a call to an external service (calling a URL that will return a >> > value of type string) which i will then add to the form data and do the >> > actual submit. >> > What is the best way to handle this in Tapestry? >> >> In the same way you'd do without Tapestry: using some JavaScript to make >> the call to the external service, then changing some field values to >> reflect the result, them programatically submitting the form. >> >> > So for e.g >> > >> > @Log >> > Object onSubmitFromTestForm() { >> > >> > //need to make some form of AJAX or javascript call here to the URL >> > provided >> > //that will return a value >> >> I'm confused: do you want to call the external service before the form >> submission, through AJAX and JavaScript or after (onSubmit is after the >> form submission, looking at the HTML side, as it's processing the form >> submission), server-side. If after (server-side), just use something like >> Apache HttpClient to do the request. This isn't affected by being done in >> a Tapestry page or component class at all. >> >> > String key = $.ajax... //not sure how to call the URL in tapestry that >> > will get me the value >> >> This is just about jQuery, not being related to Tapestry at all. >> >> -- >> Thiago H. de Paula Figueiredo >> Tapestry, Java and Hibernate consultant and developer >> http://machina.com.br >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [hidden email] >> For additional commands, e-mail: [hidden email] >> >> >> >> If you reply to this email, your message will be added to the discussion >> below: >> http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Tapestry-AJAX-call-on-submit-tp5727687p5727688.html >> To unsubscribe from Apache Tapestry Mailing List Archives, click here. >> NAML