You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andreas Bohnert <ab...@online.de> on 2004/03/09 11:46:54 UTC

how to reference the field name that tapestry automatically creates?

hello again,
I already ask this question yesterday, but I try to be more specific and 
clearer this time (and I hope to get an answer, because I really run out 
of time..)

this is my component:

<span jwcid="$content$">
      <span jwcid="@Foreach" source="ognl:descLinkList" 
index="ognl:doIdx" value="ognl:doUsrLnk">
          <input jwcid="@TextArea" wrap="off" 
style="visibility:collapse;" value="ognl:langRes[doIdx]" rows="2" 
cols="20"/>
          <a jwcid="@GenericLink" onClick="ognl:linkJS" 
href="javascript:void(0)">xyz</a>
      </span>
</span>


inside the onclick javascript handler from the GenericLink component I 
have to reference the field name of the above TextArea field.
in this case it would be $TextArea,  $TextArea$0, $TextArea$1 and so on...
but if my form contains more than one of this components, I can not 
assume that.

how can I access the name of the TextArea field?
thanks for any help
andreas







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


Re: how to reference the field name that tapestry automatically creates?

Posted by Andreas Bohnert <ab...@online.de>.
that's a very good idea!
I have not thought about the 'id' as yet. I had just the 'name' in my mind.

thanks very much!!
andreas

Mindbridge wrote:

>One possible approach is to set the 'id' parameter of the TextArea to
>anything you want, and then reference it from JavaScript in that way. It
>could be the name of the component + a counter, for example -- that will
>make it both unique and predictable.
>
>e.g.
><input jwcid="@TextArea" .... id="ognl:textAreaId"/>
>
>
>public String getTextAreaId()
>{
>    ...
>}
>
>Does this help?
>
>----- Original Message ----- 
>From: "Andreas Bohnert" <ab...@online.de>
>To: <ta...@jakarta.apache.org>
>Sent: Tuesday, March 09, 2004 12:46 PM
>Subject: how to reference the field name that tapestry automatically
>creates?
>
>
>  
>
>>hello again,
>>I already ask this question yesterday, but I try to be more specific and
>>clearer this time (and I hope to get an answer, because I really run out
>>of time..)
>>
>>this is my component:
>>
>><span jwcid="$content$">
>>      <span jwcid="@Foreach" source="ognl:descLinkList"
>>index="ognl:doIdx" value="ognl:doUsrLnk">
>>          <input jwcid="@TextArea" wrap="off"
>>style="visibility:collapse;" value="ognl:langRes[doIdx]" rows="2"
>>cols="20"/>
>>          <a jwcid="@GenericLink" onClick="ognl:linkJS"
>>href="javascript:void(0)">xyz</a>
>>      </span>
>></span>
>>
>>
>>inside the onclick javascript handler from the GenericLink component I
>>have to reference the field name of the above TextArea field.
>>in this case it would be $TextArea,  $TextArea$0, $TextArea$1 and so on...
>>but if my form contains more than one of this components, I can not
>>assume that.
>>
>>how can I access the name of the TextArea field?
>>thanks for any help
>>andreas
>>
>>
>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>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: how to reference the field name that tapestry automatically creates?

Posted by Mindbridge <mi...@yahoo.com>.
One possible approach is to set the 'id' parameter of the TextArea to
anything you want, and then reference it from JavaScript in that way. It
could be the name of the component + a counter, for example -- that will
make it both unique and predictable.

e.g.
<input jwcid="@TextArea" .... id="ognl:textAreaId"/>


public String getTextAreaId()
{
    ...
}

Does this help?

----- Original Message ----- 
From: "Andreas Bohnert" <ab...@online.de>
To: <ta...@jakarta.apache.org>
Sent: Tuesday, March 09, 2004 12:46 PM
Subject: how to reference the field name that tapestry automatically
creates?


> hello again,
> I already ask this question yesterday, but I try to be more specific and
> clearer this time (and I hope to get an answer, because I really run out
> of time..)
>
> this is my component:
>
> <span jwcid="$content$">
>       <span jwcid="@Foreach" source="ognl:descLinkList"
> index="ognl:doIdx" value="ognl:doUsrLnk">
>           <input jwcid="@TextArea" wrap="off"
> style="visibility:collapse;" value="ognl:langRes[doIdx]" rows="2"
> cols="20"/>
>           <a jwcid="@GenericLink" onClick="ognl:linkJS"
> href="javascript:void(0)">xyz</a>
>       </span>
> </span>
>
>
> inside the onclick javascript handler from the GenericLink component I
> have to reference the field name of the above TextArea field.
> in this case it would be $TextArea,  $TextArea$0, $TextArea$1 and so on...
> but if my form contains more than one of this components, I can not
> assume that.
>
> how can I access the name of the TextArea field?
> thanks for any help
> andreas
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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: how to reference the field name that tapestry automatically creates?

Posted by Andreas Bohnert <ab...@online.de>.
thanks marilen,
I have to use the 'id' approach, because there is no way to create the 
jwcid's dynamically.

regards
andreas


Marilen Corciovei wrote:

>If your javascript component is inserted after component which name you
>need then it is possible to do something like:
>
><span jwcid="ta1@TextArea" .../>
><span jwcid="@Script" param="ognl:components.ta1.name" ..../>
>
>this way you can pass the textarea name to the script. The name will
>replace the ${param} in the script definition.
>
>For more complicated examples you will need to use the id method
>described by Mindbridge..
>
>Len
>
>
>On Tue, 2004-03-09 at 12:46, Andreas Bohnert wrote:
>
>  
>
>>hello again,
>>I already ask this question yesterday, but I try to be more specific and 
>>clearer this time (and I hope to get an answer, because I really run out 
>>of time..)
>>
>>this is my component:
>>
>><span jwcid="$content$">
>>      <span jwcid="@Foreach" source="ognl:descLinkList" 
>>index="ognl:doIdx" value="ognl:doUsrLnk">
>>          <input jwcid="@TextArea" wrap="off" 
>>style="visibility:collapse;" value="ognl:langRes[doIdx]" rows="2" 
>>cols="20"/>
>>          <a jwcid="@GenericLink" onClick="ognl:linkJS" 
>>href="javascript:void(0)">xyz</a>
>>      </span>
>></span>
>>
>>
>>inside the onclick javascript handler from the GenericLink component I 
>>have to reference the field name of the above TextArea field.
>>in this case it would be $TextArea,  $TextArea$0, $TextArea$1 and so on...
>>but if my form contains more than one of this components, I can not 
>>assume that.
>>
>>how can I access the name of the TextArea field?
>>thanks for any help
>>andreas
>>
>>
>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>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: how to reference the field name that tapestry automatically creates?

Posted by Marilen Corciovei <le...@nemesisit.rdsnet.ro>.
If your javascript component is inserted after component which name you
need then it is possible to do something like:

<span jwcid="ta1@TextArea" .../>
<span jwcid="@Script" param="ognl:components.ta1.name" ..../>

this way you can pass the textarea name to the script. The name will
replace the ${param} in the script definition.

For more complicated examples you will need to use the id method
described by Mindbridge..

Len


On Tue, 2004-03-09 at 12:46, Andreas Bohnert wrote:

> hello again,
> I already ask this question yesterday, but I try to be more specific and 
> clearer this time (and I hope to get an answer, because I really run out 
> of time..)
> 
> this is my component:
> 
> <span jwcid="$content$">
>       <span jwcid="@Foreach" source="ognl:descLinkList" 
> index="ognl:doIdx" value="ognl:doUsrLnk">
>           <input jwcid="@TextArea" wrap="off" 
> style="visibility:collapse;" value="ognl:langRes[doIdx]" rows="2" 
> cols="20"/>
>           <a jwcid="@GenericLink" onClick="ognl:linkJS" 
> href="javascript:void(0)">xyz</a>
>       </span>
> </span>
> 
> 
> inside the onclick javascript handler from the GenericLink component I 
> have to reference the field name of the above TextArea field.
> in this case it would be $TextArea,  $TextArea$0, $TextArea$1 and so on...
> but if my form contains more than one of this components, I can not 
> assume that.
> 
> how can I access the name of the TextArea field?
> thanks for any help
> andreas
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>