On Tue, 22 Jul 2014 13:38:48 -0300, Shahid Shaikh <sshaikh1...@yahoo.com.invalid> 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: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to