0

Client-Server communication

asked 2013-12-13 16:07:28 +0800

Tristan2583 gravatar image Tristan2583
13 3

Hi all.

I'm using Google Maps API in a ZK simple application and I'm having some trouble when I want to communicate the map state to the components of ZK.

By the way this code is an example:

<div>
<!-- HIDDEN FIELD USED TO COMMUNICATE WITH THE GOOGLEMAP -->
<input type="hidden" name="txt" value="Hello" id="inputLat" onchange="changeLat(this)" onclick="setLatValue(this)">
<input type="hidden" name="txt" value="Hello" id="inputLng" onchange="changeLng(this)" onclick="setLngValue(this)">
<script type="text/javascript">
    function setLatValue(val){
                                        var res = val.value;
                                        res = res.replace(".",",");
                                        res = res.substring(0, 10);
                                        zk.Widget.$('$latitude').setValue(res);
                                        var evt = zk.Event(zk.Widget.$('$latitude'), "onChange", {toServer:true});
                                        zAu.send(evt);
                                    }
                                    function setLngValue(val){
                                        var res = val.value;
                                        res = res.replace(".",",");
                                        res = res.substring(0, 10);
                                        zk.Widget.$('$longitude').setValue(res);
                                        var evt = zk.Event(zk.Widget.$('$longitude'), "onChange", {toServer:true});
                                        zAu.send(evt);
                                    }
                                </script>
                            </div>
                            <div id="map-canvas"/>

                        </body>
                    </html>

In the zul file I have something like that:

<doublespinner id="latitude" value="@save(gpsvm.latitude, before='goTo')" width="140px" />              
<doublespinner id="longitude" value="@save(gpsvm.longitude, before='goTo')" width="140px"/>

In the js file that control the map I fire an onchange event that change the value of the two html input component, but then I want to put this value in the zk doublespinner components.

How could I do that? Should I send an AuRequest to the server? And if so, how?

Thanks a lot.

P.S. Sorry, I'm a newbie!

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-12-17 14:53:28 +0800

Tristan2583 gravatar image Tristan2583
13 3

Resolved with an appropriate zAu.send.

Anyway, thanks to all!

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-12-13 16:07:28 +0800

Seen: 16 times

Last updated: Dec 17 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More