[Geomoose-users] Read values of DropDown List Box

Brent Fraser bfraser at geoanalytic.com
Wed Jan 18 10:24:20 EST 2012


I did a similar thing to zoom to extents originally stored in a database when a user selects a entry from the combo box list:

1. I changed geomoose.html to geomoose.php and added some PHP to set the event function and populate the list:

<select id="GA_SelectedImage" onchange="GeoMOOSE.UX.registered_extensions.GA_ImageOps.prototype.zoomToImage(this.value);">
		<option value="">Choose Image:</option>
<?php
   while ($row = pg_fetch_array($result)) {
     echo '<option value="'.$row['imageid'] . ":" . $row['extents'] . ":" . $row['path'] . '">' . $row['imagename'] . "</option>";
	print "\n";
   }
?>
</select>


2. I then wrote a GeoMoose (JavaScript) extension to (among other things) zoom to the extents stored in the list's value:

GA_ImageOps = new OpenLayers.Class(GeoMOOSE.UX.Extension, {
   zoomToImage:function(sParams) {
       var aParams = sParams.split(':');
       var id = aParams[0];
       var bounds = aParams[1];
       var aBounds = bounds.split(',');
	:
	:
       GeoMOOSE.zoomToExtent(minXY.lon, minXY.lat, maxXY.lon, maxXY.lat );
   }
   ,
	CLASS_NAME: "GA_ImageOps"
});
GeoMOOSE.UX.register('GA_ImageOps');


You could write an extension to do a GeoMOOSE.startService instead of GeoMOOSE.zoomToExtent in my extension.

Best Regards,
Brent Fraser


On 1/17/2012 9:58 PM, gayani wrote:
> Hi,
> I need to add the data to dropdown list box from a results of database
> query.  Then users are allowed to selected a one from the list (in dropdown
> list box).  I did this in PHP.  Then, it is needed to pass the user selected
> value to next php page.  In geomoose application this should be done through
> the mapbook.xml. Isnt it?
>
> The problem is, unable to read the user selected value by the php program in
> same location.  The sample code is as follows.
>
> <select name=’province’ onchange=”&lt;?php print
> “javascript:GeoMOOSE.startService(‘xmlService’,{variable:&lt;b>user_selection*}”?>”>
> <option value=$row[‘id’]>$row[‘name’]</option>
> </select>
>
>
> Here I need to a value for user_selection.  How can I do this?  Can you
> please help me to solve this issue.
>
> Thanks Gayani
>
> --
> View this message in context: http://geomoose-users.964460.n3.nabble.com/Read-values-of-DropDown-List-Box-tp3668340p3668340.html
> Sent from the Geomoose-users mailing list archive at Nabble.com.
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geomoose-users
>



More information about the Geomoose-users mailing list