I got a ui:repeat with a few input elements with actionlisteners and i want to change the style of the elements, if they were edited by a user.

I'm aware that through the ui:repeat we have different scopes for the components on the server and client side. Therefore i wanted to get the selected loop index or the clientID of a element to call a javascript function to change the style.

This works fine for e.g my selectOneMenu, i call a method with ajax and get the right clientID. But if i try the same thing with my calendar i always get the last element / index of the ui:repeat loop and not the selected one...

My jsf:

```
<ui:repeat var="carservice" value="#{searchCarProject.editProjects}" varStatus="loop" id="repeat">
<p:selectOneMenu id="menu1" value="#{carservice.carProject.brand}" style="width:38px !important;">
    <f:selectItem itemLabel="" itemValue="" />
    <f:selectItems value="#{searchCarProject.carProjectBeanService.brands}" var="i" itemLabel="#{i.value} - #{i.label}" itemValue="#{i}"/>
    <p:ajax event="change" listener="#{searchCarProject.menuSelect}" update="errorGrid innerGrid " partialSubmit="true"/>
    <f:converter binding="#{mlCarProjectAttributeConverter}" />
</p:selectOneMenu>

<p:calendar id="cal1" widgetVar="deDateWidget" pattern="dd.MM.yyyy" value="#{carservice.carProject.termin_de}" mindate="#{searchCarProject.currentDate}" navigator="true">
    <p:ajax event="dateSelect" listener="#{searchCarProject.calSelect}"/>
</p:calendar>
</ui:repeat>

```

My server-methods:

```
    //for selectOneMenues
public void menuSelect(final AjaxBehaviorEvent event) {
    final String id = event.getComponent().getClientId();
    //id = selectionForm:entryActionTabs:repeat:0:menu1 <- 0 = the right selected one    
}

//for calendar
public void calSelect(final AjaxBehaviorEvent event) {
    final String id = event.getComponent().getClientId();
    //id = selectionForm:entryActionTabs:repeat:5:cal1 <- always 5 = always the last index    
}

```

So after the event won't give me the right value for the calendar i thought i should try it with the var attributes:

```
<p:calendar id="de_calendar" widgetVar="deDateWidget" pattern="dd.MM.yyyy" value="#{carservice.carProject.termin_de}" mindate="#{searchCarProject.currentDate}" navigator="true">
    <f:ajax event="dateSelect" listener="#{searchCarProject.calSelectWithAttributes(**loop.index,carservice.carProject.name**)}"/>
</p:calendar>

```

But i still get only the last values, if i do the same with the selectOneMenu i get the selected ones...

```
public void calSelectWithAttributes(final int index, final String name) {
index = always 5 = always the last index, name = obj name, is always the last one same as index
}

```

So i have no idea why selectOneMenu gives me the right loop.index / attribute / event but only the calendar always the last...

Edit: Even tried it with a h:dataTable, excactly the same problem...Ajaxevent returns always the last id for the calendar.