-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi everybody,
I'm looking for a way to add an onKeyUp event listener from code site (from a class which extends Textbox). I can add this event listener from ZUL with client namespace but in this case, I can't access to the ZK textbox after the treatments of onKeyUp...
Does someone have an idea ?
Thanks
I reformulate and give you more details.
I would like to use Google autocomplete place JS lib.
So I have a textbox :
<textbox id="txbAddress"></textbox>
I need to access to the native input element in order to use Google AE Place lib, so I wrote this code :
<script type='text/javascript' src='http://maps.googleapis.com/maps/api/js?libraries=places&sensor=true'> <textbox id='txbAddress'> <attribute name='onFocus'> <![CDATA[ Clients.evalJavaScript("var me = document.getElementById('" + self.getUuid() + "');"); if (self.getAttribute("ginit") == null) { Clients.evalJavaScript("var ac = new google.maps.places.Autocomplete(me);"); Clients.evalJavaScript("google.maps.event.addListener(ac,'place_changed',function(){" + "var place = ac.getPlace();" + "var lat=place.geometry.location.lat();" + "var lng=place.geometry.location.lng();" + "var formatted_address=place.formatted_address;" + "alert(formatted_address);" + "});"); self.setAttribute("ginit", true); } ]]> </attribute> </textbox>
This code does an alert with the formatted address which is returned by Google lib, so it's working.
==> My problem now is to get the place value from Java code side. But I don't know how to access to the ZK component value from it's native JS var...
I try to do somethings like this :
$(me).attr('toto', 'i want to get this sentence');
And from Java code site I tried the getAttribute function and also I tried to get the component using UUID too and nothing is working (like the component is not refreshed by ZK because the attribute is created when I'm looking the source code)
Asked: 2012-08-11 08:39:52 +0800
Seen: 211 times
Last updated: Aug 13 '12