You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Alonso Sanchez <da...@oc.mde.es> on 2008/08/19 11:59:47 UTC

[t5] Is there anyway of passing parameters to expressions?

Sorry for the strange subject :D, but i don't know the correct way to name
it. I have something that looks like this:

<script type="text/javascript">
    function showWindow2()
    {
        ${window2.componentResources.id}.setTitle("Ayuda")     
        ${window2.componentResources.id}.setURL("${generarEnlace}");
        
        ${window2.componentResources.id}.showCenter()
    }
</script>

But I would like to do something like adding two params to ShowWindow2
function and pass them to "generarEnlace". The thing is that... it could be
possible?

My final goal is to develop the functionality of helping links with modal
windows, where un link looks like this:

javascript:showWindow2(12,35) 
javascript:showWindow2(12,37) 

Each number are id's of form and field, respectively.

Thanks in advance for the support ;D
-- 
View this message in context: http://www.nabble.com/-t5--Is-there-anyway-of-passing-parameters-to-expressions--tp19047455p19047455.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


Re: [t5] Is there anyway of passing parameters to expressions?

Posted by Bill Holloway <bi...@peoplepad.com>.
"But I would like to do something like adding two params to ShowWindow2
function and pass them to "generarEnlace". The thing is that... it could be
possible?"

I don't see why not.  Make a .js file with the function

function setupHelp (win2id, generarEnlace)
{
	$('clickable_thing').observe('click', function(event) {
		win2id.setTitle("Ayuda")
		win2id.setURL(generarEnlace);
		win2id.showCenter();
	});
}

where 'clickable_item' is the html id of something that you want to
have pop up the help window when clicked.  Then use @IncludeJavaScript
to add that .js file to your component.  Inject RenderSupport and then
override afterRender:

void afterRender ()
{
	_renderSupport.addScript("setupHelp(%s, '%s');", window2.componentResources.id,
		generarEnlace.toString());
}


On Wed, Aug 20, 2008 at 1:31 AM, Daniel Alonso Sanchez
<da...@oc.mde.es> wrote:
>
> Wow, thank you so much for the support. At first i would give a try to the
> easiest solution, then i will test the second.
>
> Thank you so much again for everything ;D
> --
> View this message in context: http://www.nabble.com/-t5--Is-there-anyway-of-passing-parameters-to-expressions--tp19047455p19063586.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
>
>



-- 
Bill @ PeoplePad

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


Re: [t5] Is there anyway of passing parameters to expressions?

Posted by Daniel Alonso Sanchez <da...@oc.mde.es>.
Wow, thank you so much for the support. At first i would give a try to the
easiest solution, then i will test the second.

Thank you so much again for everything ;D
-- 
View this message in context: http://www.nabble.com/-t5--Is-there-anyway-of-passing-parameters-to-expressions--tp19047455p19063586.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


Re: [t5] Is there anyway of passing parameters to expressions?

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,

I assume the URL you set on window2 is for a page. In that case you can 
get the base URL from componentResources.createPageLink("pagename", 
true) and attach the form and field ids in your JavaScript:

${window2.componentResources.id}.setURL("${basehelpurl}/" + formId + "/" 
+ fieldId);

You can then get the form and fields ids from onActivate(int, int) on 
your help page. That's the quick and dirty way, anyhow.

-Filip

On 2008-08-19 11:59, Daniel Alonso Sanchez wrote:
> Sorry for the strange subject :D, but i don't know the correct way to name
> it. I have something that looks like this:
> 
> <script type="text/javascript">
>     function showWindow2()
>     {
>         ${window2.componentResources.id}.setTitle("Ayuda")     
>         ${window2.componentResources.id}.setURL("${generarEnlace}");
>         
>         ${window2.componentResources.id}.showCenter()
>     }
> </script>
> 
> But I would like to do something like adding two params to ShowWindow2
> function and pass them to "generarEnlace". The thing is that... it could be
> possible?
> 
> My final goal is to develop the functionality of helping links with modal
> windows, where un link looks like this:
> 
> javascript:showWindow2(12,35) 
> javascript:showWindow2(12,37) 
> 
> Each number are id's of form and field, respectively.
> 
> Thanks in advance for the support ;D

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


Re: [t5] Is there anyway of passing parameters to expressions?

Posted by Chris Lewis <ch...@bellsouth.net>.
Hello,

This is a classic case of needing client-side behavior with server-side
knowledge, and would be handled well by OO javascript. You could create
a component for this but is seems like a mixin might be more
appropriate. Checkout this article:

http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained

It goes through the steps of creating a mixin fundamentally similar to
what you need. You also might checkout the chenillekit / t5c window
component.

http://212.202.126.8/chenillekit-tapestry/ref/org/chenillekit/tapestry/core/components/Window.html


Daniel Alonso Sanchez wrote:
> Sorry for the strange subject :D, but i don't know the correct way to name
> it. I have something that looks like this:
>
> <script type="text/javascript">
>     function showWindow2()
>     {
>         ${window2.componentResources.id}.setTitle("Ayuda")     
>         ${window2.componentResources.id}.setURL("${generarEnlace}");
>         
>         ${window2.componentResources.id}.showCenter()
>     }
> </script>
>
> But I would like to do something like adding two params to ShowWindow2
> function and pass them to "generarEnlace". The thing is that... it could be
> possible?
>
> My final goal is to develop the functionality of helping links with modal
> windows, where un link looks like this:
>
> javascript:showWindow2(12,35) 
> javascript:showWindow2(12,37) 
>
> Each number are id's of form and field, respectively.
>
> Thanks in advance for the support ;D
>   

-- 
http://thegodcode.net


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