darshakshah1988 / gmaps4jsf

Automatically exported from code.google.com/p/gmaps4jsf
0 stars 1 forks source link

Call JSF 2.0 ajax bean action on moveend event. #110

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. set jsFunction on moveend event in gmap:eventlistener 
2. use jsf.ajax.request() JavaScript as part of JSF 2.0 to post form
commandButton

What is the expected output? What do you see instead?
Using a form with hidden fields, it is expected that the ajax request would
update field values in the managed bean and call the managed bean action in
the commandButton. 

Nothing happens, however if you manually click the commandButton, the
correct action occurs.

What version of the product are you using? On what operating system?
1.1.3 u2
Glassfish 3
Linux 2.6.31
Java SE 1.6.15

Please provide any additional information below.
This is the opposite of a usual use case; instead of a user performing some
action in a form that updates the map, here we want the map to update the
managed bean using Ajax to retrieve more information about the new location
of the map.

Source code reproducer attached. 

Original issue reported on code.google.com by shamilt...@gmail.com on 23 Apr 2010 at 6:29

Attachments:

GoogleCodeExporter commented 8 years ago
I saw your sample,
Please set renderOnWindowLoad="false" and try again.

Original comment by Hazem.sa...@gmail.com on 21 May 2010 at 2:01

GoogleCodeExporter commented 8 years ago
It still doesn't seem to work, the bean method updateLocation() is never called.
I just tried redeploying it with renderOnWindowLoad="false" (I must have 
accidentally
changed it to true after testing it with false in the uploaded version) and it 
still
isn't calling the bean method. I tried a similar thing with OpenLayers4JSF and 
the
bean method gets called, but there are a number of other features missing in
OpenLayers4JSF, so I'd prefer to use gmaps4jsf.

Original comment by det.scot...@gmail.com on 21 May 2010 at 2:12

GoogleCodeExporter commented 8 years ago
I set its Priority to High.

Original comment by Hazem.sa...@gmail.com on 21 May 2010 at 3:52

GoogleCodeExporter commented 8 years ago
After seeing the code, I found a JavaScript error:
"Error: element is null
Source File:
http://localhost:8080/MapBug/javax.faces.resource/jsf.js.jsf?ln=javax.faces&stag
e=Development
Line: 1676"

because of the following line:
jsf.ajax.request("button1", "click", {execute: '@form', render: 'myMap'});

I fixed it by:
jsf.ajax.request(document.getElementById("frm:button1"), "click", {execute: 
'@form',
render: 'myMap'});

After doing this I found the messages in the log saying that the action is 
called:
"INFO: called"

So this problem is not a GMaps4JSF. GMaps4JSF responsibility ends when the 
moveend
event occurs and the JS handler function is called (Which already happens). I 
digged
more in the problem as I wished to make your code work.

Good Luck, and tell me if you have questions.

Original comment by Hazem.sa...@gmail.com on 21 May 2010 at 9:57

GoogleCodeExporter commented 8 years ago
Many many thanks, I didn't even think of doing this, but it now seems obvious in
hindsight. I was led astray by the terseness of the JSF docs. Feel free to add 
and
modify that code to your examples.

Cheers
  Scott.

Original comment by shamilt...@gmail.com on 22 May 2010 at 12:48

GoogleCodeExporter commented 8 years ago

Original comment by Hazem.sa...@gmail.com on 22 May 2010 at 6:15