如何在struts2自动填充器的值更改时调用javascript函数

Rac*_*wal 2 struts struts2 autocomplete

我正在使用struts2自动填充标签.现在我想在用户在下拉列表中选择一些值时调用javascript函数.我尝试onChange,onSelect,onClick事件,但没有任何作用:(请告诉我你的建议.

Dav*_*ton 5

你会使用Dojo"主题".

当做出选择时,valueNotifyTopics被解雇.有关详细信息,请参阅autocompleter文档.那里有一个例子,如下所示:

<script type="text/javascript">
dojo.event.topic.subscribe("/value", function(value, key, text, widget){
    alert('inside a topic event. after value changed');
    //value : selected value (like "Florida" in example above)
    //key: selected key (like "FL" in example above)
    //text: text typed into textbox
    //widget: widget that published the topic
});
</script>   

<sx:autocompleter valueNotifyTopics="/value" href="%{#ajaxTest}" />
Run Code Online (Sandbox Code Playgroud)

请注意,自Struts 2.1以来,Dojo标记已被弃用,并将在下一版本中归档.