You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mark <ma...@xeric.net> on 2011/07/04 04:14:50 UTC

How to get client side Ajax values into a page event

I am trying to integrate an image cropper with Tapestry.  Users can
select the portion of the image they want to keep and then click to
crop it--same idea as Facebook, Google Profiles, etc let you crop your
portrait when you upload it.  I'm using this:
http://www.defusion.org.uk/code/javascript-image-cropper-ui-using-prototype-scriptaculous/

My question is how do I get the variables on the client side into my
component when the user clicks submit.  In other words, when the user
selects a portion to crop they will be setting some client side
variables like:
x, y, height, width

I'd like to have a method like:
void onAction(int x, int y, int height, int width) {
   // crop the picture
}

Any suggestions or link to documentation I've overlooked would be most
appreciated.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: How to get client side Ajax values into a page event

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sun, 03 Jul 2011 23:14:50 -0300, Mark <ma...@xeric.net> wrote:

> My question is how do I get the variables on the client side into my
> component when the user clicks submit.  In other words, when the user
> selects a portion to crop they will be setting some client side
> variables like:
> x, y, height, width
>
> I'd like to have a method like:
> void onAction(int x, int y, int height, int width) {
>    // crop the picture
> }

Reading its documentation, its has a onEndCrop parameter. It's the  
callback function invoked by the JavaScript component to tell you a  
selection was made. Use ComponentResources.createEventLink() for defining  
a custom event and getting its URL. Then use Prototype's Ajax.Request  
(http://api.prototypejs.org/ajax/Ajax/Request/) (or any other framework)  
to request the event URL passing the values you want as request parameters.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: How to get client side Ajax values into a page event

Posted by sommeralex <al...@gmail.com>.
Hi!

You will find here some code snippets:
http://tapestry.1045711.n5.nabble.com/Javascript-Image-Cropper-with-Chrome-td5713110.html

if you are interested, i can also send you the full code. My approach is
working / the only bug comes with chrome. 

alex

--
View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-get-client-side-Ajax-values-into-a-page-event-tp4548742p5713307.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org