hi, lets get to the point.

Im developing an application in which a route is drawn in a map (MapGuide), in order to do this you have to select two points, one for the origin and the other one for the destiny.

I have a window divided into 3 frames.

Frame 1 : (named "leftFrame") 6 ComboBox in which the origin and destiny points can be selected. 3 Combobox to select origin and 3 combobox to select the destiny. The information in the comboboxes is obtained from a database and a button to submit the information.

Frame 2 : (named "topFrame") A control panel which contains several buttons to handle the map.

Frame 3: (named "mainFrame") The map, its an object. Kind of a google map, behavior is similar.

<frameset id="frameset1" rows="*" cols="230,*" framespacing="0" frameborder="YES" border="2">
  <frame src="nodes.jsp" noresize name="leftFrame"></frame>
  <frameset id="frameset0" rows="45,*" cols="*" frameborder="NO" border="0" scrolling="NO" noresize framespacing="0">
    <frame src="top_bar.jsp" name="topFrame" scrolling="NO"
           noresize </frame>
    <frame src="map.jsp" name="mainFrame" scrolling="NO"> </frame>
  </frameset>
</frameset>

The frameset that contains the frames is in "index.html"
Frame 1 source is: "nodes.jsp"
Frame 2 source is: "top_bar.jsp"
Frame 3 source is: "map.jsp"

After submitting the data from the frame 1, the values of the selected options in the comboboxes are sent to the map so it can draw the fastest route.

Once the route is drawn, the content of frame 1 should be replaced with a report. This report contains the name of the origin and destiny points, and the distance between the two points.

In nodes.jsp i have the code for the comboboxes and the connection to the database. (Connection is in scriplets, comboboxes are filled with javascript). All this contained in a form named "form1".

---- Javascript and scriplets to initialize combos ---- <form name="form1" action="nodes.jsp" method="get" language="JavaScript"> Note that the action is the same as the frame 1 source, this is because once you select the option in the first combobox, the second combobox is updated with information related to the first combobox selection.

In the same jsp there is a form named "form2", this is the one that submits the information. This form has as action "process.jsp". <form name="form2" method="POST" action="process.jsp" target="other"> In "process.jsp" through several algorithms and the mapguide api, the route can be traced. Also this jsp contains a form named "form3", so when the process of calculating the route finishes, this form is submitted and the report is created using information obtained from the "form 2".

The body of "process.jsp" has OnLoad="document.form3.submit();" and form3 is as follows: <form name="form3" method="POST" action="report.jsp" target="leftFrame"> All of this works perfectly (after a couple of weeks of hard work :P )
the problem is that when i submit form2, a blank window appears, this window is "process.jsp". I dont want this to appear, I want this process to go background.

Ive tried to change the target of form2, but the result is never the desired. As an option i thought about making this window a "Please Wait..." or a "Processing Route" window, but i dont know if the process can be affected by doing this.

I hope you can help me with this. Thanks in advanced!!

Kurtybain,

The keyword here is "AJAX", which allows a server-side process to be called from JavaScript and for its response to be returned into Javascript, which then executes a function to present the returned data or whatever else is required of it.

An AJAX request is an alternative to form submission. The fundamental difference is that with AJAX the calling page is not refreshed. All aspects of the DOM and all current JavaScript objects therefore remain intact.

AJAX is too large an topic to give a detailed exaplanation here but there are plenty of tutorials on the web. If you already understand JavaScript and server-side scripting, then AJAX is not hard to learn. Trickiest part for most people is probably the DOM scripting required to handle the server response.

You may also need to investigate JSON, which is a well supported technique (in both server-side languages and JavaScript) for sending encoded data/objects via HTTP such that it can be decoded and used the other side.

I think that AJAX and possibly JSON are what you need.

Hope this helps.

Airshow

Thanks for your reply!

Is it possible that you can post an example code just to figure it out?? the rest i'll do it by myself ;)

Thanks in advanced.

Kurtybain,

As I said,

AJAX is too large an topic to give a detailed exaplanation here but there are plenty of tutorials on the web.

Try Altavista-ing (I'm fed up saying 'Goolgling' all the time) "ajax tutorial".

There are also many ajax questions here on Daniweb, which give sample code (some of which might actually work).

Same with JSON.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.