On Wed, 30 Oct 2013 21:30:00 -0200, Asma Merchant <amerch...@renau.com>
wrote:
I am a newbie in Tapestry. I tried to search on web on how to pass
parameters from javascript to tapestry but couldn't find much
information.
In my very humble opinion, passing dynamic (i.e. defined in JavaScript)
data to Tapestry is better left to query parameters instead of the context
due to the way Tapestry encodes stuff in URLs.
Here's my Javascript code:
jQuery(document).ready( function(){
jQuery(document).on("click", ".pulseMode", function () {
var radioId = jQuery(this).data('id'); //I can get my button's id here
//how do I pass it to tapestry?
});
I'd try that, not tested:
jQuery(document).ready( function(){
jQuery(document).on("click", ".pulseMode", function () {
var radioId = jQuery(this).data('id'); //I can get my
button's id here
var link = jQuery('yesButton');
link.href = ...;// code to remove everything after the '?' from
link.href, if it's there, and add
// '?id=' + radioId.
});
Then, on the Java side:
XXX onChangePulseMode(@RequestParameter("id") String id) {
...
}
That's an specific solution to your problem. The general solution for the
"pass information from JS to Tapestry via AJAX". See this thread:
http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/dynamically-changing-event-link-context-on-client-side-using-js-td4268096.html.
I can provide another better example if you want, but I need to leave my
computer right now. :)
Here's the modal's yes button code:
<div class="modal-footer">
<a id="yesButton" t:type="web/eventlinkex" t:event="changePulseMode"
href="#" class="btn btn-primary" t:parameters="prop:{'mode':'?'}"
${message:yes }</a>
<a href="#" class="btn" data-dismiss="modal">${message:no }</a>
</div>
--
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