On 14/11/2009 14:09, Niccolo Rigacci wrote: > Thank you Armin, I'm moving my first steps. > > On Fri, Nov 13, 2009 at 04:50:28PM +0100, Armin Burger wrote: >> 'container': defines the ID of a <div> element to add the dialog to. But >> don't worry too much with this, if the container with this ID does not >> exist it will be created automatically. > > I need to > > 1) display the dialog > 2) submit the form to the server > 3) display the result (success/fail) in the dialog > 4) eventually close the dialog > > I need some hints on step 2 and 3. Is there some piece of code > already in pmapper or should I use plain XMLHttpRequest? >
I would suggest to use the jQuery $.ajax function. If tyou have a look at the plugin 'coordinates': There is the x_*.php file that in your case is the 'digitizepoints.php'. The url used in the ajax call is to this file var digitizeUrl = PM_PLUGIN_LOCATION + '/digitizepoints/digitizepoints.php?lon=' + px + "&lat=" + py + ....; All the values from the form have to be placed in the request in addition to the parameters that you use already (lon, lat, __action). Instead of adding everything to the url query part you can also use the parameters array for the ajax call. See the jquery docs, they're quite good. Reading the form values and transforming them to key=value list can e.g. be done via the function in pm.form.js PM.Form.getFormKVP() returns everything in a string ready for URL concatenation, like "&key1=value1&key2=value2..." or PM.Form.getFormKvpObjAll() that returns everything in object/array notation, like {key1: value1, key2: value2,...}. The return value to be inserted can be already plain HTML created by the PHP, then you need to specify this in the ajax call as dataType: "html", a sample part for the ajax would be $.ajax({ url: digitizeUrl, dataType: "html", success: function(response){ $('#containerWhereTodisplayHtml').html(response); > Armin, do you think that the notes you wrote sould go into the > wiki? I can try to arrange them in a page. > Yes, please do so, e.g. below the part http://svn.pmapper.net/trac/wiki/FaqCustomizations and creating a new paragraph like "using p.mapper dialogs with createDnRDlg" armin ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ pmapper-users mailing list pmapper-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pmapper-users