调用Java脚本函数的道场自动补足更改时价值 [英] Calling a java-script function when value of a Dojo auto-completer changes

查看:120
本文介绍了调用Java脚本函数的道场自动补足更改时价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想调用JavaScript函数时的道场自动完成者的值发生变化。

I am trying to call a javascript function when the value of a Dojo auto completer changes.

调用从的onChange属性中的JavaScript函数没有效果(我指的是功能不叫/执行)。

Calling the javascript function from the "onChange" attribute has no effect (I mean the function is not called/executed).

在javascript函数我想:

In the javascript function I want to:


  1. 呼叫Struts2的行动。

  1. Call a struts2 action.

更​​改隐藏字段的值。

Change the value of a hidden field.

有关调用动作我有另一种方式:结果
发布使用属性valueNotifyTopic =topicName的话题,那么我可以通过听专题打电话的动作。

For calling the action I have another way :
publishing a topic using attribute " valueNotifyTopic="topicName" ", then I can call an action by listening to the topic.

但我不能通过这样的方式改变隐藏字段的值。所以,我需要调用javascript函数

But I cant change the value of the hidden field through this way. So I need to call a javascript function

请指教

谢谢!

编辑:

这是JSP中的code:

This is the code in the jsp:

<s:url id="scriptURL" action="viewContactInfo" />
<sd:div href="%{scriptURL}" listenTopics="viewContactInfo" formId="contactInfo" showLoadingText="false" preload="false">
<s:form id="contactInfo">
    <sd:autocompleter autoComplete="false" name="customer" list="customerList" valueNotifyTopics="viewContactInfo"/> 
    <sd:autocompleter autoComplete="false" name="contact"  list="contactList"  valueNotifyTopics="viewContactInfo"/>
    <s:hidden id="chngd" value="initial"/>
</s:form>
</sd:div>

在这里,如果我改变valueNotifyTopics ='viewContactInfo'到的onChange ='dojo.event.topic.publish('viewContactInfo');的行动viewContactInfo停止获取调用。而同样的事情(下称的onChange一)与其他元素的作品(在其他地方在我的项目)。

Here if I change "valueNotifyTopics='viewContactInfo'" to "onChange='dojo.event.topic.publish('viewContactInfo');'" the action "viewContactInfo" stops getting called. Whereas the same thing (the "onChange" one) works with other elements (in other places in my project).

推荐答案

我已经开始另一个线程的这个问题。

I had started another thread for this question.

我想出了解决方案,并已张贴在这里的答案是:

I figured out the solution and have posted the answer here :

无法找到一个方法来传递一个隐藏的价值的行动文件

希望这有助于!

这篇关于调用Java脚本函数的道场自动补足更改时价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆