You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Glen Stampoultzis <gs...@iinet.net.au> on 2004/02/19 09:38:08 UTC
Scripting question
If I have a variable number of controls inside a ListEdit loop how to I
reference the controls.
To be more specific, I have a some checkboxes and some text fields. If a
checkbox is checked I want to enable the text box for that line.
Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Scripting question
Posted by Harish Krishnaswamy <hk...@comcast.net>.
Please see Howard's mail. Its easier that way.
-Harish
Harish Krishnaswamy wrote:
> AFAIK, you have to write a script specification that spits out the js
> within a foreach for each item in the ListEdit.
>
> <body>
> <unique>
> function disable(checkbox, field)
> {
> ...
> }
> </unique>
> </body>
>
> <initialization>
> <foreach key="${...}" expression="${...}">
> disable(${checkbox}, ${field});
> </foreach>
> </initialization>
>
> -Harish
>
> Glen Stampoultzis wrote:
>
>>
>> If I have a variable number of controls inside a ListEdit loop how to
>> I reference the controls.
>>
>> To be more specific, I have a some checkboxes and some text fields.
>> If a checkbox is checked I want to enable the text box for that line.
>>
>>
>>
>>
>> Glen Stampoultzis
>> gstamp@iinet.net.au
>> http://members.iinet.net.au/~gstamp/glen/
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Scripting question
Posted by Harish Krishnaswamy <hk...@comcast.net>.
AFAIK, you have to write a script specification that spits out the js
within a foreach for each item in the ListEdit.
<body>
<unique>
function disable(checkbox, field)
{
...
}
</unique>
</body>
<initialization>
<foreach key="${...}" expression="${...}">
disable(${checkbox}, ${field});
</foreach>
</initialization>
-Harish
Glen Stampoultzis wrote:
>
> If I have a variable number of controls inside a ListEdit loop how to
> I reference the controls.
>
> To be more specific, I have a some checkboxes and some text fields.
> If a checkbox is checked I want to enable the text box for that line.
>
>
>
>
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: Scripting question
Posted by Glen Stampoultzis <gs...@iinet.net.au>.
Thanks Howard,
That makes a lot of sense I'll add it to the FAQ.
Regards,
Glen
At 11:20 PM 19/02/2004, you wrote:
>You need to put a Script component inside the ListEdit loop that
>establishes the connection between
>the checkbox and the text field.
>
>As a form control component renders, it invokes the form's getElementId()
>method. It uses the
>returned value as the name attribute of the <input> tag it renders, and
>leaves that value in its
>name property after it finishes rendering ... just so you can figure out
>the HTML control's name for
>JavaScript purposes.
Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/
RE: Scripting question
Posted by Glen Stampoultzis <gs...@iinet.net.au>.
I seem to have solved it through the hacky use of an id.
I do have one remaining issue.
If define a new function through each iteration of the Foreach loop is it
possible to create another function that calls all the function's I created?
Regards,
Glen
At 05:03 PM 3/03/2004, Glen Stampoultzis wrote:
>To bring up an old thread.
>
>This seems to mostly work pretty well. One additional problem I'm having
>is with RadioGroup's. Because all options in a radio group have the same
>name I'm not sure how I refer to any given option. Maybe using the id
>attribute?
>
>-- Glen
>
>At 11:20 PM 19/02/2004, you wrote:
>>You need to put a Script component inside the ListEdit loop that
>>establishes the connection between
>>the checkbox and the text field.
>>
>>As a form control component renders, it invokes the form's getElementId()
>>method. It uses the
>>returned value as the name attribute of the <input> tag it renders, and
>>leaves that value in its
>>name property after it finishes rendering ... just so you can figure out
>>the HTML control's name for
>>JavaScript purposes.
>>
>>--
>>Howard M. Lewis Ship
>>Independent J2EE / Open-Source Java Consultant
>>Creator, Tapestry: Java Web Components
>>http://howardlewisship.com
>>
>>
>> > -----Original Message-----
>> > From: Glen Stampoultzis [mailto:gstamp@iinet.net.au]
>> > Sent: Thursday, February 19, 2004 3:38 AM
>> > To: tapestry-user@jakarta.apache.org
>> > Subject: Scripting question
>> >
>> >
>> >
>> > If I have a variable number of controls inside a ListEdit
>> > loop how to I
>> > reference the controls.
>> >
>> > To be more specific, I have a some checkboxes and some text
>> > fields. If a
>> > checkbox is checked I want to enable the text box for that line.
>> >
>> >
>> >
>> >
>> > Glen Stampoultzis
>> > gstamp@iinet.net.au
>> > http://members.iinet.net.au/~gstamp/glen/
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>> >
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>Glen Stampoultzis
>gstamp@iinet.net.au
>http://members.iinet.net.au/~gstamp/glen/
Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/
RE: Scripting question
Posted by Glen Stampoultzis <gs...@iinet.net.au>.
To bring up an old thread.
This seems to mostly work pretty well. One additional problem I'm having
is with RadioGroup's. Because all options in a radio group have the same
name I'm not sure how I refer to any given option. Maybe using the id
attribute?
-- Glen
At 11:20 PM 19/02/2004, you wrote:
>You need to put a Script component inside the ListEdit loop that
>establishes the connection between
>the checkbox and the text field.
>
>As a form control component renders, it invokes the form's getElementId()
>method. It uses the
>returned value as the name attribute of the <input> tag it renders, and
>leaves that value in its
>name property after it finishes rendering ... just so you can figure out
>the HTML control's name for
>JavaScript purposes.
>
>--
>Howard M. Lewis Ship
>Independent J2EE / Open-Source Java Consultant
>Creator, Tapestry: Java Web Components
>http://howardlewisship.com
>
>
> > -----Original Message-----
> > From: Glen Stampoultzis [mailto:gstamp@iinet.net.au]
> > Sent: Thursday, February 19, 2004 3:38 AM
> > To: tapestry-user@jakarta.apache.org
> > Subject: Scripting question
> >
> >
> >
> > If I have a variable number of controls inside a ListEdit
> > loop how to I
> > reference the controls.
> >
> > To be more specific, I have a some checkboxes and some text
> > fields. If a
> > checkbox is checked I want to enable the text box for that line.
> >
> >
> >
> >
> > Glen Stampoultzis
> > gstamp@iinet.net.au
> > http://members.iinet.net.au/~gstamp/glen/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/
RE: Scripting question
Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
You need to put a Script component inside the ListEdit loop that establishes the connection between
the checkbox and the text field.
As a form control component renders, it invokes the form's getElementId() method. It uses the
returned value as the name attribute of the <input> tag it renders, and leaves that value in its
name property after it finishes rendering ... just so you can figure out the HTML control's name for
JavaScript purposes.
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Tapestry: Java Web Components
http://howardlewisship.com
> -----Original Message-----
> From: Glen Stampoultzis [mailto:gstamp@iinet.net.au]
> Sent: Thursday, February 19, 2004 3:38 AM
> To: tapestry-user@jakarta.apache.org
> Subject: Scripting question
>
>
>
> If I have a variable number of controls inside a ListEdit
> loop how to I
> reference the controls.
>
> To be more specific, I have a some checkboxes and some text
> fields. If a
> checkbox is checked I want to enable the text box for that line.
>
>
>
>
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org