List Info

Thread: ui:repeat id generation problem




ui:repeat id generation problem
user name
2006-10-29 06:36:32
Hello, i have the following simple code:

<ui:repeat var="receiver"
value="#{message.receivers}">
  <input id="member_#{receiver.member_id}"
value="#{receiver.nickName}" 
jsfc="h:inputText" />
  <h:outputText value="#{receiver.member_id}"
/>
</ui:repeat">

the valid expression value #{receiver.member_id} is not
evaluated for 
the "id" attribute, its just empty.
The strange thing is that its outputted correct by
<h:outputText>.

I need to generate the id with an el expression.

Can someone give me a hint how to do it with ui:repeat?
(c:forEach i 
cant use for some reasons i cant explain here(ajax stuff)) 

------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
For additional commands, e-mail: users-helpfacelets.dev.java.net

ui:repeat id generation problem
user name
2006-10-30 21:48:04
+1. I ran into exactly the same problem and can attest that
in the below 
example #{receiver.member_id} would evaluate correctly if it
was 
assigning value='', but not id=''. Seems to me that inside a
given 
element 'id' attribute gets assigned before bean values are
set, but 
other attributes get assigned after bean values are set.

-nikita

Holger Prause wrote:
> Hello, i have the following simple code:
>
> <ui:repeat var="receiver"
value="#{message.receivers}">
>  <input id="member_#{receiver.member_id}"
value="#{receiver.nickName}" 
> jsfc="h:inputText" />
>  <h:outputText
value="#{receiver.member_id}" />
> </ui:repeat">
>
> the valid expression value #{receiver.member_id} is not
evaluated for 
> the "id" attribute, its just empty.
> The strange thing is that its outputted correct by
<h:outputText>.
>
> I need to generate the id with an el expression.
>
> Can someone give me a hint how to do it with ui:repeat?
(c:forEach i 
> cant use for some reasons i cant explain here(ajax
stuff))
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
> For additional commands, e-mail: users-helpfacelets.dev.java.net
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
For additional commands, e-mail: users-helpfacelets.dev.java.net

ui:repeat id generation problem
user name
2006-10-30 21:48:04
+1. I ran into exactly the same problem and can attest that
in the below 
example #{receiver.member_id} would evaluate correctly if it
was 
assigning value='', but not id=''. Seems to me that inside a
given 
element 'id' attribute gets assigned before bean values are
set, but 
other attributes get assigned after bean values are set.

-nikita

Holger Prause wrote:
> Hello, i have the following simple code:
>
> <ui:repeat var="receiver"
value="#{message.receivers}">
>  <input id="member_#{receiver.member_id}"
value="#{receiver.nickName}" 
> jsfc="h:inputText" />
>  <h:outputText
value="#{receiver.member_id}" />
> </ui:repeat">
>
> the valid expression value #{receiver.member_id} is not
evaluated for 
> the "id" attribute, its just empty.
> The strange thing is that its outputted correct by
<h:outputText>.
>
> I need to generate the id with an el expression.
>
> Can someone give me a hint how to do it with ui:repeat?
(c:forEach i 
> cant use for some reasons i cant explain here(ajax
stuff))
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
> For additional commands, e-mail: users-helpfacelets.dev.java.net
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
For additional commands, e-mail: users-helpfacelets.dev.java.net

ui:repeat id generation problem
user name
2006-10-31 00:06:00
Nikita Tovstoles schrieb:
> +1. I ran into exactly the same problem and can attest
that in the 
> below example #{receiver.member_id} would evaluate
correctly if it was 
> assigning value='', but not id=''. Seems to me that
inside a given 
> element 'id' attribute gets assigned before bean values
are set, but 
> other attributes get assigned after bean values are
set.
>
> -nikita
>
> Holger Prause wrote:
>> Hello, i have the following simple code:
>>
>> <ui:repeat var="receiver"
value="#{message.receivers}">
>>  <input
id="member_#{receiver.member_id}" 
>> value="#{receiver.nickName}"
jsfc="h:inputText" />
>>  <h:outputText
value="#{receiver.member_id}" />
>> </ui:repeat">
>>
>> the valid expression value #{receiver.member_id} is
not evaluated for 
>> the "id" attribute, its just empty.
>> The strange thing is that its outputted correct by
<h:outputText>.
>>
>> I need to generate the id with an el expression.
>>
>> Can someone give me a hint how to do it with
ui:repeat? (c:forEach i 
>> cant use for some reasons i cant explain here(ajax
stuff))
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
>> For additional commands, e-mail: users-helpfacelets.dev.java.net
>>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
> For additional commands, e-mail: users-helpfacelets.dev.java.net
>
>

Excatly , that what happening, well this is really a problem
when u need 
to access this ids (for example from javascript).
For my case i found a workaround, assing a styleclass
<ui:repeat var="receiver"
value="#{message.receivers}">
 <input
styleClass="member_#{receiver.member_id}"
value="#{receiver.nickName}"
jsfc="h:inputText" />
 <h:outputText value="#{receiver.member_id}"
/>
</ui:repeat">

Then use prototype to get the element by stylclass (not id)
                 <script
type="text/javascript">
                     //stupid workaround course source
h:inputText dont 
get its id stable rerendered
                     inputField = 
document.getElementsByClassName("member_#{receiver.memb
er_id}")[0];       
                    new Ajax.Autocompleter(inputField.id, 
"autocomplete_#{receiver.member_id}",
"/myapp/autocomplete.seam", 
{paramName: "value"});
                </script>







------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
For additional commands, e-mail: users-helpfacelets.dev.java.net

ui:repeat id generation problem
user name
2006-10-31 00:06:00
Nikita Tovstoles schrieb:
> +1. I ran into exactly the same problem and can attest
that in the 
> below example #{receiver.member_id} would evaluate
correctly if it was 
> assigning value='', but not id=''. Seems to me that
inside a given 
> element 'id' attribute gets assigned before bean values
are set, but 
> other attributes get assigned after bean values are
set.
>
> -nikita
>
> Holger Prause wrote:
>> Hello, i have the following simple code:
>>
>> <ui:repeat var="receiver"
value="#{message.receivers}">
>>  <input
id="member_#{receiver.member_id}" 
>> value="#{receiver.nickName}"
jsfc="h:inputText" />
>>  <h:outputText
value="#{receiver.member_id}" />
>> </ui:repeat">
>>
>> the valid expression value #{receiver.member_id} is
not evaluated for 
>> the "id" attribute, its just empty.
>> The strange thing is that its outputted correct by
<h:outputText>.
>>
>> I need to generate the id with an el expression.
>>
>> Can someone give me a hint how to do it with
ui:repeat? (c:forEach i 
>> cant use for some reasons i cant explain here(ajax
stuff))
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
>> For additional commands, e-mail: users-helpfacelets.dev.java.net
>>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
> For additional commands, e-mail: users-helpfacelets.dev.java.net
>
>

Excatly , that what happening, well this is really a problem
when u need 
to access this ids (for example from javascript).
For my case i found a workaround, assing a styleclass
<ui:repeat var="receiver"
value="#{message.receivers}">
 <input
styleClass="member_#{receiver.member_id}"
value="#{receiver.nickName}"
jsfc="h:inputText" />
 <h:outputText value="#{receiver.member_id}"
/>
</ui:repeat">

Then use prototype to get the element by stylclass (not id)
                 <script
type="text/javascript">
                     //stupid workaround course source
h:inputText dont 
get its id stable rerendered
                     inputField = 
document.getElementsByClassName("member_#{receiver.memb
er_id}")[0];       
                    new Ajax.Autocompleter(inputField.id, 
"autocomplete_#{receiver.member_id}",
"/myapp/autocomplete.seam", 
{paramName: "value"});
                </script>







------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
For additional commands, e-mail: users-helpfacelets.dev.java.net

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )