![](/img/trans.png)
[英]Elements that were returned from a function don't work with event listeners
[英]Event triggers don't work on field elements in spring roo
我正在嘗試在create.jspx頁面中使用onblur事件,但不會觸發。 我需要編輯其他內容才能正常工作嗎?
這是create.jspx頁面
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<div xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:field="urn:jsptagdir:/WEB-INF/tags/form/fields" xmlns:form="urn:jsptagdir:/WEB-INF/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:spring="http://www.springframework.org/tags" version="2.0">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<jsp:output omit-xml-declaration="yes"/>
<form:create id="fc_org_rooinaction_taskmanager_model_Task" modelAttribute="task" path="/tasks" render="${empty dependencies}" z="93eOjqRPoEhu9mi9qUmUfCOZKd0=">
<field:textarea field="description" id="c_org_rooinaction_taskmanager_model_Task_description" required="true" z="zNvxTl9doPKsiJUnOX7KJNQpMC8="/>
<field:checkbox field="completed" id="c_org_rooinaction_taskmanager_model_Task_completed" z="5zv/49txPJAAAPeAgZM62nofTFs="/>
<input id="inputField"/>
</form:create>
<form:dependency dependencies="${dependencies}" id="d_org_rooinaction_taskmanager_model_Task" render="${not empty dependencies}" z="LRiLPref3RLI6Z8pks9LvWX5VuM="/>
然后,我為id = _description_id編寫javascript onblur事件處理程序,以下代碼不起作用:
document.getElementById("_description_id").onblur=function(){
alert(document.getElementById("_description_id").value);
}
但是,如果我用常規輸入元素的ID(id = inputField)更改其ID,則可以使用:
document.getElementById("inputField").onblur=function(){
alert(document.getElementById("_description_id").value);
}
然后在屏幕上呈現時,Spring Roo元素就是dojo元素。 您需要為dojo添加事件列表器。
dojo.connect(dijit.byId(""),"blur",function(){
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.