I'm trying to use the onblur event in a create.jspx page but it doesn't fire. Do i need to edit something else for it to work?
This is the create.jspx page
<?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:
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:
document.getElementById("inputField").onblur=function(){
alert(document.getElementById("_description_id").value);
}
Spring roo elements are dojo elements when then rendered on the screen. You need to add event listner for dojo.
dojo.connect(dijit.byId(""),"blur",function(){
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.