Looking at the original post, it looks like the person wants a unique  
"name" attribute.

But Andy's solution will provide a unique "id" attribute. (As "name"  
is a reserved parameter in TextField, and is calculated using the  
components original ID - not the bound id).

So I feel that, even though the ID is unique, the name still can  
conflict and result in the the data being clobbered - as HTML form  
submission uses the "name" attribute, rather than the "id" attribute.

On 14-Sep-06, at 11:48 AM, andyhot wrote:

> Here's a trick that some tacos components use to get past this issue.
>
> in your CustomField.jwc
>
> <component id="myTextField" type="TextField" inherit-informal- 
> parameters="yes">
>         <binding name="id" value="components.myTextField.idPath"/>
>         <binding name="name" value="name"/>
> </component>
>
>
> ognl:components.tableSection.idPath
>
> Chaitanya Jeerage wrote:
>> Issue: Data *wrongly* getting updated due to Tapestry/Tacos handling
>> of Textfield Name convention when it is embedded within a custom
>> component.
>>
>> When we use a Custom component which has a Text Field in it, we can
>> end up with two TextFields with the **SAME NAME** after an
>> AjaxEventSubmit call.
>>
>> So let's say we have:
>>
>> <span jwcid="[EMAIL PROTECTED]" source="ognl:telephones"
>> value="ognl:currentTelephone">
>>    <input jwcid="[EMAIL PROTECTED]:customField"  
>> value="ognl:currentTelephone.number"/>
>> </span>
>>
>> <span jwcid="[EMAIL PROTECTED]" source="ognl:emails"  
>> value="ognl:currentTelephone">
>>    <input jwcid="[EMAIL PROTECTED]:customField"  
>> value="ognl:currentEmail.email"/>
>> </span>
>>
>> The "customField" component has a embedded "TextField"
>>
>> The custom component looks like this:
>>
>> CustomField.jwc partial code
>>
>>     <component id="TextField" type="TextField"
>> inherit-informal-parameters="yes">
>>         <binding name="id" value="id"/>
>>         <binding name="name" value="name"/>
>>     </component>
>>
>>
>> So when the Page is initially rendered, the TextFields come with  
>> Names
>> as "TextField_0", "TextField_1" etc.  NOTE however that there is no
>> distinguishing by naming convention which TextField "belongs" to  
>> which
>> component, via naming convention.   The reason for TextField_0 seems
>> to be because of the JWCID in the CustomField.jwc
>>
>> Now when we have an Ajax call to add a Telephone number to the
>> Telephone List the clash occurs!  Since add to the Telephone list
>> creates a new TextField_xx, it clashes with the Emails because we're
>> doing a partial refresh of the Telephone List portion using Ajax.
>>
>> On form submit we can get some Telephone data into Email fields!!
>>
>> However, in the same scenario, if we directly use a "TextField"
>> instead of the custom component, for ex
>>
>> <span jwcid="[EMAIL PROTECTED]" source="ognl:telephones"
>> value="ognl:currentTelephone">
>>    <input jwcid="[EMAIL PROTECTED]"  
>> value="ognl:currentTelephone.number"/>
>> </span>
>>
>> on addition of rows to the "telephones" list,  new input text fields
>> are added to the screen and the name generated are like  "tele",
>> "tele_0", "tele_1" , Note, here it is using the jwcid value and so
>> works fine!!
>>
>> If TextField could "inherit" it's name from its enclosing component,
>> we would not have any issues!!
>>
>> Any pointers please?!
>>
>> thanks
>>
>> --------------------------------------------------------------------- 
>> ----
>> Using Tomcat but need to do more? Need to support web services,  
>> security?
>> Get stuff done quickly with pre-integrated technology to make your  
>> job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
>> Geronimo
>> http://sel.as-us.falkag.net/sel? 
>> cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Tacos-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/tacos-devel
>>
>>
>
>
> -- 
> Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
> Tapestry / Tacos developer
> Open Source / J2EE Consulting
>
>
> ---------------------------------------------------------------------- 
> ---
> Using Tomcat but need to do more? Need to support web services,  
> security?
> Get stuff done quickly with pre-integrated technology to make your  
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
> Geronimo
> http://sel.as-us.falkag.net/sel? 
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Tacos-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tacos-devel
>


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Tacos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tacos-devel

Reply via email to