[英]Event triggers don't work on field elements in spring roo
I'm trying to use the onblur event in a create.jspx page but it doesn't fire. 我正在尝试在create.jspx页面中使用onblur事件,但不会触发。 Do i need to edit something else for it to work?
我需要编辑其他内容才能正常工作吗?
This is the create.jspx page 这是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="/>
Then i write the javascript onblur event handler for id=_description_id, the code below doesn't work: 然后,我为id = _description_id编写javascript onblur事件处理程序,以下代码不起作用:
document.getElementById("_description_id").onblur=function(){
alert(document.getElementById("_description_id").value);
}
But if i change the id with that of a regular input element (id=inputField) it works: 但是,如果我用常规输入元素的ID(id = inputField)更改其ID,则可以使用:
document.getElementById("inputField").onblur=function(){
alert(document.getElementById("_description_id").value);
}
Spring roo elements are dojo elements when then rendered on the screen. 然后在屏幕上呈现时,Spring Roo元素就是dojo元素。 You need to add event listner for dojo.
您需要为dojo添加事件列表器。
dojo.connect(dijit.byId(""),"blur",function(){
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.