开发者

Passing selected item to ajax function

开发者 https://www.devze.com 2023-03-27 23:06 出处:网络
<a4j:jsFunction name=\"addTag\" action=\"#{serverBean.irrelevantMethod(_tagId)}\"> <a4j:param name=\"param1\" assignTo=\"#{_tagId}\"/>
<a4j:jsFunction name="addTag" action="#{serverBean.irrelevantMethod(_tagId)}">
   <a4j:param name="param1" assignTo="#{_tagId}"/>
</a4j:jsFunction>

<rich:autocomplete autocompleteList="#{tags}" mode="ajax" var="_tag" 
                   fetchValue="#{_tag.id}" onselectitem="addTag();" />

The question is related to onselectitem: how to pass the selected item, which should be _tag.id, to the jsFunction 'addTag' as a parameter?

I have tried:

onse开发者_运维问答lectitem="addTag('#{_tag.id}')"

but it doesn't work.

What I want is to send the selected tag (its id) to server when autocomplete selection occurs. What would be the best way to achieve this if the above is a doomed attempt.


I don't believe there is a way to pass a param like that, but action="#{irrelevantMethod(_tagId)}" will definitely not work. It will try to find it on the server.

0

精彩评论

暂无评论...
验证码 换一张
取 消