> -----Original Message-----
> From: Szabo Attila [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 18, 2005 5:12 PM
> To: [EMAIL PROTECTED]
> Subject: Javascript problem
> 
> Hello Howard!
> 
> I`ve been working with Tapestry for 6 months. We`re writing a 
> web based
> loan system for a bank, and we`re using Tapestry. But till 
> today we have
> big problems with inserting javascript into our pages. 
> 
> My problem is the following:
> 
> If I have a form with dinyamical content ( for exmaple: 
> depeneds on the
> state it contains different number checkboxes ), and I need 
> all the form
> elements for the javascript ( like the previous example: part of the
> checkboxes have exlude type, so if one of these checked all the others
> most be disabled ) I have to get the "render name" ( I mean 
> the name with
> the components rendered in the html like "value$52" )

The naming used by Tapestry is a bit squirrely.  The term is "elementId".  The 
point is, the unique
id for the field within its containing form, which becomes the name attribute 
of the <input> (or
other) tag.  Starting with Tapestry 4.0, each field also renders a page-unique 
id attribute (that is
often the same as the name, but not always). This second id is the "clientId".

So, just put your Script components after the Checkbox components.

In your case, its more complicated, because you are using a loop.  I think you 
are on to something;
collecting the ids into a List and passing that into the script template.  
There's a <foreach>
element you can use inside script templates.

>  of the 
> components
> in the render() phase, and put into a Collection or something 
> else, and
> give it to the script as a symbol. I think it`s very very ugly.

Alternately, creating a custom component that renders out the necessary checbox 
but also generates
the JavaScript.

> 
> I have two short questions:
> 
> 1. Is there any other way to get the component`s "render 
> name"? (I render 
> these components using Foreach component)

After a component has rendered, its name property contains its elementId (name 
attribute), and its
its clientId property contains its client id (id attribute).

> 
> 2. In the future will be any other way insted of symbol to 
> give parameters
> to a script. I mean it will be very good if I could give a 
> "script render 
> name" to a component and I could use it when I "bind" the script
> parameters.

I don't have specific plans for changes here in 4.0 or 4.1, but as I do more 
JavaScript intensive
AJAX stuff, I'm sure I'll be looking for ways to make it easier.

> 
> I hope you can solve my problem with an elegant solution, and 
> can expalin
> the main concept how to use scrpits in Tapestry.
> 
> I`m looking forward your answer as soon as possible, and in advance I
> thank your answer so much!
> 
> Your sincerely!
> 
> Attila Szabo
> ([EMAIL PROTECTED])
> 

Please direct all Tapestry questions to [EMAIL PROTECTED] Most reasonable 
questions
are answered quickly and accurately. A guide to posting questions is available:
http://jakarta.apache.org/tapestry/problems.html



Alternately, if your need is urgent, I can provide professional support for 
Tapestry, on an hourly
basis. Please consult my website, http://howardlewisship.com/, for details.


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to