<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;"><div><pre id="line1">I am going to try this again, and include the relevant code this time in the post.<br><br>How can I enable default event handling for a textfield input in a custom control?<br><br>When I place a textfield into a control on the map, it does not receive mouse events or keyboard events.&nbsp; <br>How can I make the textfield receive these events and handle them as it normally would?<br><br>Any help greatly appreciated.<br><br><span>This is example of what I am talking about:&nbsp; <a rel="nofollow" target="_blank" href="http://sites.google.com/site/javamike9/javascript/test5.html?attredirects=0&amp;d=1"><span class="yshortcuts" id="lw_1260808939_0">http://javamike9.webs.com/oltextControl.htm</span></a></span><br><br><br><br><br>Here is the (very simple) javascript portion of
 the problem:<br><br>OpenLayers.Control.TextFieldControl = OpenLayers.Class(OpenLayers.Control, <br>{<br>  draw: function() {<br>   OpenLayers.Control.prototype.draw.apply(this, arguments);<br>   var element = document.createElement('div');<br>   element.className = this.displayClass + 'Element';<br>   var inputElement = document.createElement('input');<br>   inputElement.type='text';<br>   inputElement.value='test';<br>   element.appendChild(inputElement);<br><br>   //element.innerHTML = "&lt;input type='text' value='test'&gt;&lt;/input&gt;";<br>   this.div.appendChild(element);<br>   return this.div;<br>  },<br>  CLASS_NAME: 'OpenLayers.Control.TextFieldControl'<br>});<br><br>function init()<br>{<br>  var map = new OpenLayers.Map( 'map' );<br>  var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br><span>    "<a target="_blank" href="http://labs.metacarta.com/wms/vmap0">http://labs.metacarta.com/wms/vmap0</a>",</span><br>    {layers: 'basic'} <br> 
 );<br>  map.addLayer(layer);<br>  var myCustomControl = new OpenLayers.Control.TextFieldControl();<br>  map.addControl(myCustomControl);<br>  map.zoomToMaxExtent();<br>}<br><br><br></pre></div>
<!-- cg3.c1.mail.mud.yahoo.com compressed/chunked Fri Dec 11 09:05:11 PST 2009 -->
</div><br>

      </body></html>