You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Robert Binna <r....@synedra.com> on 2006/10/25 17:44:37 UTC

getClientId() seems to output the wrong value

Hi

Since my last update on tapestry 4.1 I have a problem when using 
getClientId().
I have a Component (DateRangePicker) consisting of a SelectBox and two 
DropDownDatePickers.
To do some javascript (setting the datePicker 
visible/invisible,depending on the range type 
(between,from,to,noSelection)). I want to get the clientIds of the 
subWidgets. Before the update all worked but now the clientIds seem to 
be calculated wrong or I am using them wrong.

I am getting my ids as follows (part of the renderComponent method of 
the DateRangePicker):

    super.renderComponent(writer, cycle);

    Map<String,String> parms = new HashMap<String,String>();
    parms.put("selectId", getComponent("rangeSelection").getClientId());
    parms.put("beginId", getComponent("begin").getClientId());
    parms.put("endId", getComponent("end").getClientId());

My DateRangePickers are defined as follows in the Page template:
    <div jwcid="@DateRangePicker" value="ognl:range1"/>
    <div jwcid="@DateRangePicker" value="ognl:range2"/>

The template Code of the DateRangePicker component:
    <div class="date-range-picker">
            <select jwcid="rangeSelection@PropertySelection" 
value="ognl:currentSelection" model="ognl:ranges"></select>
            <div jwcid="begin@DropdownDatePicker" value="ognl:beginDate"/>
            <div jwcid="end@DropdownDatePicker" value="ognl:endDate"/>
       </div>

The generated javascript with the corresponding ids (retrieved through 
the code above is):

	new synedra.DateRangePicker("rangeSelection","begin","end",{"0":"","1":"today","2":"yesterday","3":"precise","4":"between","5":"before","6":"after","7":"lastweek","8":"lastmonth"});

	new synedra.DateRangePicker("rangeSelection","begin","end",{"0":"","1":"today","2":"yesterday","3":"precise","4":"between","5":"before","6":"after","7":"lastweek","8":"lastmonth"});

But the expected code would be:

	new synedra.DateRangePicker("rangeSelection","begin","end",{"0":"","1":"today","2":"yesterday","3":"precise","4":"between","5":"before","6":"after","7":"lastweek","8":"lastmonth"});

	new synedra.DateRangePicker("rangeSelection_0","begin_0","end_0",{"0":"","1":"today","2":"yesterday","3":"precise","4":"between","5":"before","6":"after","7":"lastweek","8":"lastmonth"});

 
I hope someone can help me to.

Kind, regards
             Robert



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


Re: getClientId() seems to output the wrong value

Posted by Robert Binna <r....@synedra.com>.
Thanks for your answer, but I checked the problem again and I don't have 
2 different forms.

As far as I have understood the main Problem is that in the render 
method of AbstractComponent
the _clientId is erased in the finally block.

To solve my problem I am doing the following workaround:
cycle.getUniqueId(TapestryUtils.convertTapestryIdToNMToken(<embedded 
component id>))

But this workaround seems a bit odd too me. How do others solve this 
issue of getting the client id of an embedded component

What are you thinking about moving this code to 
TapestryUtils.getUniquedId(<component>) ?
or changing the code of the getClientId() that it allways returns the 
correct id and no only while rendered?

Kind regards,
             Robert



Patrick Moore schrieb:

> your problem may be the same as mine. Did you see if you have 2
> different forms on the same page?
>
> https://issues.apache.org/jira/browse/TAPESTRY-1131
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


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


Re: getClientId() seems to output the wrong value

Posted by Patrick Moore <tr...@gmail.com>.
your problem may be the same as mine. Did you see if you have 2
different forms on the same page?

https://issues.apache.org/jira/browse/TAPESTRY-1131

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