Ciao a tutti,<br>sto studiando un esempio di wfs-t in OpenLayers con punti provenienti dal database PostGIS e gestiti attraverso Geoserver.<br>Ho inserito le funzioni di spostamento, di rimozione, di visualizzazione info sul layer wms e di salvataggio.Queste funzioni vanno bene e fungono perfettamente.<br>
Volevo poi creare una funzione di Inserimento punto con un apertura di un form in cui si potessero riempire i campi di attributi appartenente al vettore wfs.Il form appare come un popup il problema è che all'inserimento dati non si aggiornano i campi di attributo nel wfs. <br>
L'esempio ha preso spunto da quest'altro a tale link : <a href="http://www.gisandchips.org/demos/j3m/wfs/wfs_golf.html">http://www.gisandchips.org/demos/j3m/wfs/wfs_golf.html</a> <br clear="all">mentre il mio codice della funzione è questo:<br>
<br>      var drawPoint = new OpenLayers.Control.DrawFeature(<br>                wfs_layer, OpenLayers.Handler.Point,<br>                {    multi:false,<br>                    displayClass: 'olControlDrawFeaturePoint',<br>
                    featureAdded: function InsertFeature(feature){<br>                                        selectedFeature=feature;<br>                                        var fid=selectedFeature.id;<br>                                        var CATEGORIA=selectedFeature.attributes['CATEGORIA'];<br>
                                        var PROVINCIA=selectedFeature.attributes['PROVINCIA'];<br>     <br>                                                <br>                                                     htmlForm="<div style='font-size:.8em'>"+<br>
                                                     '<h2><b>Inserire i Dati</b></h2>\n'+<br>                                                     "FID: "+fid+ "<br/>\n" +"<input type='hidden' name='fid' id='fid' value='"+ fid +"'>" +<br>
                                                     "CATEGORIA:<input type='text' name='CATEGORIA' id='CATEGORIA' value='Categoria' size=20 style='background-color: #E6E6FA; color: #7F7F7F; font-style: italic;' > <br/>\n" +<br>
                                                     "PROVINCIA:<input type='text' name='PROVINCIA' id='PROVINCIA' value='provincia' size=15 style='background-color: #E6E6FA; color: #7F7F7F; font-style: italic;' > <br/>\n" +<br>
                                                    "<button onclick=btnInsert>Salva</button>"+"</div>"<br>                                                             //definizione popup<br>
                                                             popup = new OpenLayers.Popup.FramedCloud("info",<br>                                                             feature.geometry.getBounds().getCenterLonLat(),<br>
                                                             null,<br>                                                             htmlForm,<br>                                                             null,<br>                                                             true                                                             <br>
                                                             );<br>                                                            <br><br>                                                      feature.popup = popup;<br>                                                      map.addPopup(popup);<br>
                                                      <br><br>                                                      var btnInsert=new OpenLayers.Control.Button({trigger:function Update(fid){<br>                                                    <br>
                                                                      var fid=new OpenLayers.Util.getElement('fid').value;<br>                                                                      var mioFeature=wfs_layer.getFeaturebyId(fid);<br>
                                                                      <br>                                                                      //attribuisce il valore inserito dal Form all'attributo della Feature<br>
                                                                      miofeature.attributes.CATEGORIA=OpenLayers.Util.getElementById('CATEGORIA').value;<br>                                                                      miofeature.attributes.PROVINCIA=OpenLayers.Util.getElementById('PROVINCIA').value;<br>
                                                                      <br>                                                                      //Rimuove popup<br>                                                                      map.removePopup(mioFeature.popup);<br>
                                                                      mioFeature.popup.destroy();<br>                                                                      mioFeature.popup = null;<br><br>                                                                    } //fine update<br>
                                                      <br>                                                      }); //fine trigger<br>  <br>                                                  <br>                                                <br>
                                                //     else info<br>                                            } //fine Insert function<br><br>Vi ringrazio anticipatamente per l'aiuto.Ciao<br>-- <br>Nicola De Innocentis<br>
<br><a href="http://www.nicoladeinnocentis.it" target="_blank">www.nicoladeinnocentis.it</a><br><br>