Hi You can't use JavaScriptSupport directly from environment in action phase but you can do this
@Inject private AjaxResponseRenderer ajaxResponseRenderer; Object onSuccess(){ ... ajaxResponseRenderer.addCallback(new JavaScriptCallback() { @Override public void run(JavaScriptSupport javaScriptSupport) { do_whatever_you_want_to_do_with_javaScriptSupport(); } }); } regards Taha On May 17, 2012, at 10:56 PM, Juan Alba wrote: > Hi, > > I am working with modals in my application, for this I have done my own > mixin that uses *colorbox* for the modal. > > My problem, right now is that I have a form in one of those modals that has > to redirect when is submited. > I have two methods in the class: > > @Inject > private JavaScriptSupport javaScriptSupport; > > void onValidateFromAddRouteForm() throws ValidationException{ > all the validations... > } > > Object onSuccess(){ > //Adding the script to close the modal and forwarding the "parent > iframe". > javaScriptSupport.addScript("jQuery.colorbox.close();"); > return ShowRoutePlan.class; > } > > When I get to the succes and want to close with the modal iframe I have > this run time error: > No object of type > org.apache.tapestry5.services.javascript.JavaScriptSupport is available > from the Environment. > > I have read something about not being able to add javascriptSupport on > render methods or something like that, but I am not sure if this is just > one of those cases where I just can't use javascriptSupport. > If it is, how can I add the javascript function for closing the page? Or to > redirect the parent instead of the iframe. > > > Cheers and Thanks in advance! --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org