jquery cfml trigger('change')不工作 [英] jquery cfml trigger('change') not working
问题描述
我需要的是绑定到列出文件类型的查询的cfselect,列出保存的文件的cfdiv,以及扫描图像以保存为PDF文件的按钮,其名称以输入值为前缀字段。
What I need is a cfselect bound to a query that lists file types, a cfdiv that lists the saved files, and a button that scans an image to be saved as a pdf file with the name prefixed by the value of the input field.
简单页面。
<cfselect name="DocType" id="DocType" class="selectClass" query="qGetDocTypes" display="name" value="DocTypeID">
<input name="ScanDocument" id="ScanDocument" type="text" value="" class="ScanDocument">
<cfdiv id="handler_#docAreaID#" bind="url:#request.controlurl#documentHandler/?docareaID=#docareaID#&variableID=#variableID#&Fav=#attributes.Fav#&userid=#attributes.userid#&showform=1&ScannedDocument={ScanDocument@change}">
// remove blanks from text
ScanDoc1 = $('input.scandocument').val();
ScanDoc = ScanDoc1.replace(/\s/g, '');
<cfoutput>
ColdFusion.navigate('url:#request.controlurl#documentHandler/?docareaID=#docareaID#&variableID=#variableID#&Fav=#attributes.Fav#&userid=#attributes.userid#&showform=1&ScannedDocument='+ScanDoc);
</cfoutput>
coldFusion.Navigate不会刷新CFdiv,它也会触发onBrowseAway的事件主要形式动作。我可以通过手动更改输入的值来模拟div刷新,但是在我得到这个工作后,它将被隐藏。
The coldFusion.Navigate does NOT refresh the CFdiv, and it also trigger an event for onBrowseAway I use for the main form action. I can simulate the div refresh by manually changing the value of the input but it will be hidden after I get this to work.
推荐答案
让我先介绍一下,我没有使用 ColdFusion.navigate
功能之前,但根据这里的文档该函数需要是一个链接目标。它需要在 a
标记的 href
部分中。看看我引用的文档页面上的示例。因此,尝试将您的代码添加到 a
标签,如下所示:
Let me preface this by stating that I have not used the ColdFusion.navigate
functionality before but according to the documentation here the function needs to be a link target. It needs to be in the href
portion of an a
tag. Look at the example on the documentation page that I referenced. So try adding your code to an a
tag like this:
<cfoutput>
<a href="javascript:ColdFusion.navigate('#request.controlurl#documentHandler/?docareaID=#docareaID#&variableID=#variableID#&Fav=#attributes.Fav#&userid=#attributes.userid#&showform=1&ScannedDocument='+ScanDoc,'handler_#docAreaID#');">click here</a>
</cfoutput>
请注意,我删除了 url:
从您的代码。这似乎没有必要。
Notice that I removed the url:
text from your code. That does not appear to be necessary.
它也出现了,因为你缺少函数的容器
参数。该文档声明,如果您缺少此参数,链接将被视为正常的URL,整个页面将被刷新。 (虽然你的代码不是一个链接?)
It also appeared as though you are missing the container
parameter for the function. The documentation states that if you are missing this parameter the link will be treated as a normal URL and the entire page will be refreshed. (Although your code was not a link?)
此外,我不知道你是否可以像函数一样引用函数的URL中的ColdFusion变量。这些是服务器端的,这个功能是客户端(javascript)。就像我说的,我从来没有使用过这些,但这些是我的阅读文档后的想法。
Also, I'm not sure if you can reference the ColdFusion variables in the URL of the function like you are. Those are server-side and this function is client-side (javascript). Like I said, I have never used this before but these are my thoughts after reading that documentation.
这篇关于jquery cfml trigger('change')不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!